此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【warword0】截止到2008-07-06 00:12:25的历史汇总数据(不包括此帖):
发帖的总数量:20                       发帖的总分数:311                      
结贴的总数量:20                       结贴的总分数:311                      
无满意结贴数:3                        无满意结贴分:70                       
未结的帖子数:0                        未结的总分数:0                        
结贴的百分比:100.00%               结分的百分比:100.00%                  
无满意结贴率:15.00 %               无满意结分率:22.51 %                  
敬礼!

解决方案 »

  1.   

    提示的错误信息是什么?
    另外,你的Eclipse里设置的JDK是1.4的还是1.5的?
      

  2.   

    setAttribute
    void setAttribute(java.lang.String name,java.lang.Object o)
    Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with RequestDispatcher. 
    Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems. 
    If the object passed in is null, the effect is the same as calling removeAttribute(java.lang.String). 
    It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet. 
    Parameters:
    name - a String specifying the name of the attribute
    o - the Object to be stored
      

  3.   

    跟Eclipse的window->preference中设置一下java ->compiler有关项。
    跟代码的级别有关系。
    大不了自己封装一下,把数据放到相应的包装器里,也不麻烦。
      

  4.   


    1.5以后提供自动装箱。会把int转为Integer,所以不会出错。1 .4会有问题。
      

  5.   

    现在jdk一般都用的1.5以上的了吧。应该是eclipse设置的问题,我的jdk1。5的也遇到过这个问题。
      

  6.   

    把你的JDK版本提高一点,因为JDK1.5之后提供了自动封装的功能,你的12132.56在JDK1.4的基础上是不能封装的,看一下JDK1.5的新特性吧
      

  7.   

    request.setAttribute(String name,Object o)
    后面的参数是Object类型 如果JDK是1。4的话你写int类型会报错
    如果JDK1。5以上会自动封装成Integer将没问题
      

  8.   

    1.5的jdk就没有问题,1.4就不行了
      

  9.   

    我用的jdk是1.6的,MyEclipse版本是6.5的,但是就像楼上几位同志说的,我也感觉是jdk的版本问题,错误提示就是说request.setAttribute("n",object) 不能写成request.setAttribute("n",double)的形式.那该咋解决呢?
      

  10.   

    我主要是想用struts里taglib里面的bean:write来格式化数字,这回传不过来了...
      

  11.   

    我建议是养成好习惯
    request.setAttribute("n", new Double(123.45));
      

  12.   

    不是jdk版本的问题,我用的jdk1.6,在netbeans建立工程的时候JavaEE版本必须选择JavaEE 5才能使用从jdk1.5之后引入的一些特性,使用j2ee 1.4或者以前的版本也是提示错误.
    eclipse不知道怎么设置,自己找找吧
      

  13.   

    eclipse的project的properties的java compiler里设置
      

  14.   


    Integer num=12132.56;
    request.setAttribute("n",num);
      

  15.   

    要5.0以上版本的JDK才支持这样的写法.
    如果是在jsp中写的没有问题,jsp中内置了request
    如果在servlet中,看参数是否是request.
      

  16.   

    我也遇到这样的问题了 request.setAttribute("result",123)出现错误是与request.setAttribute(String,Object)类型不匹配,但是在另外一个工程中可以使用阿 两个都是使用的j2ee 1.4
      

  17.   

    我用的是jdk1.5.0_16,但还是不能自动封装。
    顺便问一下:
    就是request.setAttribute("ID", new Long(number));
    到后来要取出这个ID时,怎么将这个“ID”转回Long?