代码如下:
主界面对应的类在配置文件中如下:
<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进行数据绑定?请各位不吝赐教,在线等待。
主界面对应的类在配置文件中如下:
<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进行数据绑定?请各位不吝赐教,在线等待。
ActionForward af= mapping.findForward("NewPatientPage"); af.setRedirect(true);
return af;
但是还是不行,是否可以想办法在通过修改af的属性指定其绑定的formbean为我需要的formbrean?
引起的,
我建议
1,用<a></a>代替</html:link>2,用response.sendRedirect(arg0) 试试
<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>还需要传参,并且需要去除列表中属性。
谢谢4楼,response.sendRedirect(arg0)方法也没有办法改变formberan,刚才试过了。
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,该怎么做?请高手不吝赐教
但是response到页面(NewPatientPage.jsp)的时候提示的却是PatientBaseInfoForm
楼主是指 response.sendRedirect();吗?页面与formbean的绑定是 和form的action想对象的楼主把NewPatientPage.jsp 代码贴一下
这个a.action对应的form