struts框架下如果不用session怎样把后台数据传到前台(请给出发送和接受代码)

解决方案 »

  1.   

    response.setAttribute("",'');
    response.getAttribute("");
      

  2.   

    response里面哪有什么setattribute方法。你的response是什么类给出它的完全类路径看看。
      

  3.   

    struts-config.xml file is the alrealdy get the Form mapping 
    so you can get the data from the Form
    like:
    <html:form>
    <td><html:password property="password" size="15" />
    </html:form>
    you can define the proerty in the form
      

  4.   

    <action path="/TestAction" name="testForm"....>
    你用了struts的html标签<html:form action="/TestAction">的话 ,在action中reqeust.setAttribute("testForm",obj),session.setAttribute("testForm",obj)在jsp自动会填写的或者jsp中 requst.getAttribute("XXX"),session.getAttrubute("XXX")自己取出来,爱怎么用就怎么用(没有<html:form>的时候只好这样了)
      

  5.   

    一般都是再Action里面进行业务操作的,操作完以后把你需要传到前台的对象保存再request域里面,然后再前台就可以获得这个对象了。
    ex:
    ..........
    request.setAttribute("object",MyObject);.......
    在页面可以通过标签或者scriplet来获取
    MyObject o = (MyObject)request.getAttribut("object");
    o.method();...