代码如下:
  
主界面对应的类在配置文件中如下:
<action path="/DiseaseInfo/PatientBaseInfo"
type="com.gzq.struts.action.PatientBaseInfoAction"
name="PatientBaseInfoForm"
scope="request"
parameter="command">在主界面中添加的超级链接具体如下:
<td>
    html:link href="../DiseaseInfo/baseinfo.do?command=PatReport" paramId="ComId" paramName="ele" paramProperty="comId">上报</html:link>
</td>
DiseaseInfo/baseinfo.do对应的配置文件如下:
<action path="/DiseaseInfo/baseinfo"
type="com.gzq.struts.action.BaseInforAction"
name="InputCPWayPatientForm"
scope="request"
parameter="command">
<forward name="NewPatientPage" path="/DiseaseInfo/NewPatientPage.jsp"/>
com.gzq.struts.action.BaseInforAction中PatReport代码如下:
public ActionForward PatReport(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {                 ..............略................
return mapping.findForward("NewPatientPage");

调试发现 PatReport中form对应的是InputCPWayPatientForm,但是在NewPatientPage.jsp中绑定的formbean提示却是PatientBaseInfoAction。很疑惑,不清楚为什么?难道这是Struts架构就这样的吗?我有什么办法让InputCPWayPatientForm与页面NewPatientPage.jsp进行数据绑定?请各位不吝赐教,在线等待。

解决方案 »

  1.   

    还是用struts2把  struts1太麻烦了
      

  2.   

    谢谢回复,但是目前已经做了大半的工作了,积重难返了,我想知道上述的现象Struts就这样设计的?有没有办法处理我目前的问题,我尝试过:
    ActionForward af= mapping.findForward("NewPatientPage"); af.setRedirect(true);
            return af;
    但是还是不行,是否可以想办法在通过修改af的属性指定其绑定的formbean为我需要的formbrean?
      

  3.   

    我最开始想的使用redirect,但是你回复说不行,我怀疑是</html:link>
      引起的,
    我建议
    1,用<a></a>代替</html:link>2,用response.sendRedirect(arg0) 试试
      

  4.   

    谢谢回复!主页面的是列表,如下<logic:present name="list" scope="request">
             <logic:notEmpty name="list" scope="request">
             <logic:iterate id="ele" name="list" scope="request">
             <tr bgcolor="#FFFFFF">
            
             <td><bean:write name="ele" property="forder" /></td>
             <td><bean:write name="ele" property="inp_no"/></td>
             <td>
             <html:link href="../DiseaseInfo/PatientBaseInfo.do?command=Maping" paramId="PATIENT_ID" paramName="ele" paramProperty="PATIENT_ID">
    <bean:write name="ele" property="name"/>
    </html:link>
             </td>
             <td>
             <html:link href="../DiseaseInfo/PatientBaseInfo.do?command=MasterVisit" paramId="ComId" paramName="ele" paramProperty="comId">
    <bean:write name="ele" property="VISIT_ID"/>
    </html:link>
             </td>
             <td>
             <bean:write name="ele" property="diagnosis_code"/>
             </td>
             <td>
             <bean:write name="ele" property="diagnosis_name"/>
             </td>
            
             <td>
             <bean:write name="ele" property="SEX"/>
             </td>
             <td>
             <bean:write name="ele" property="ADMISSION_DATE_TIME" format="yyyy-MM-dd HH:mm"/>
             </td>
             <td><bean:write name="ele" property="DISCHARGE_DATE_TIME" format="yyyy-MM-dd HH:mm"/></td>
             <td>
             <bean:write name="ele" property="nation"/>
             </td>
             <td>
             <bean:write name="ele" property="id_no"/>
             </td>
             <td>
             <html:link href="../DiseaseInfo/baseinfo.do?command=PatReport" paramId="ComId" paramName="ele" paramProperty="comId">
    上报
    </html:link>

             </td>
             </tr>
             </logic:iterate>还需要传参,并且需要去除列表中属性。
      

  5.   


    谢谢4楼,response.sendRedirect(arg0)方法也没有办法改变formberan,刚才试过了。
      

  6.   

    好,我简要的描述一下问题;
    1、主页面a.jps,其在struts配置文件中对应的类是如下:
    <action path="/DiseaseInfo/PatientBaseInfo"
    type="com.gzq.struts.action.PatientBaseInfoAction"
    name="PatientBaseInfoForm"
    scope="request"
    parameter="command">2、a.jps与List列表数据绑定,其中有一列具体如下:
    <td>
      html:link href="../DiseaseInfo/baseinfo.do?command=PatReport" paramId="ComId" paramName="ele" paramProperty="comId">上报</html:link>
    </td>3、“DiseaseInfo/baseinfo.do”在struts中对应的配置如下:
    <action path="/DiseaseInfo/baseinfo"
    type="com.gzq.struts.action.BaseInforAction"
    name="InputCPWayPatientForm"
    scope="request"
    parameter="command">
    <forward name="NewPatientPage" path="/DiseaseInfo/NewPatientPage.jsp"/>4、“com.gzq.struts.action.BaseInforAction”中的方法PatReport代码如下:
    public ActionForward PatReport(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {  ..............略................
    return mapping.findForward("NewPatientPage");

    5、mapping.findForward("NewPatientPage")对应的页面为NewPatientPage.jsp;6、出现问题如下:
       1)在函数PatReport中调试发现form是InputCPWayPatientForm,但是response到页面(NewPatientPage.jsp)的时候提示的却是PatientBaseInfoForm,并非希望的InputCPWayPatientForm,struts架构是否就是如此设计的?
       2)如果我希望NewPatientPage.jsp绑定的bean为InputCPWayPatientForm,该怎么做?请高手不吝赐教
      

  7.   

    这下迷迷糊糊看懂了
    但是response到页面(NewPatientPage.jsp)的时候提示的却是PatientBaseInfoForm
    楼主是指 response.sendRedirect();吗?页面与formbean的绑定是 和form的action想对象的楼主把NewPatientPage.jsp 代码贴一下
      

  8.   

    页面与formbean的绑定是 和form 的action 相对应的  即 <form action="a.action">
    这个a.action对应的form