request.setAttribute("result",new Double(result)); 是什么意思java

解决方案 »

  1.   

    在请求中添加一个result属性,值是数值型的。这个一般在java后台中设置,在前台jsp中取得。
      

  2.   

    把"result"变量放在request 中。  
      

  3.   

    这玩意儿都不去查API。。
    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.
      

  4.   

    request.setAttribute("result",new Double(result));
    给result赋值双引号中是变量名,后面的是值request.getAttribute("result")
    前台页面获取变量为result的值
      

  5.   

    setAttribute是容器request中的一个属性,类似于一个实体类中的get,set方法。才用键值对的方式存储数据,与之对应的方法是getAttribute 。通过setAttribute存进去的只,在项目的任何地方拿到对应的request之后可以用getAttribute根据键取出对应的值
      

  6.   

    就是把数据存在这个请求中,在请求的页面可以使用request.getParamater("XXX")这样的形式来读取到存取在那个请求中的数据,这样就是可以在请求中或者在页面之间传递参数了,