1
我在struts-config.xml文件中有下面的action mappings
。将属性值从jsp转发到java
<action path="/getTareWeight"
type="com.astrazeneca.usbod.scale.actions.GetTareByBarcodeAction"
name ="getTareByBarcodeForm"
scope="request"
validate="true"
input="/jsp/getTareByBarcode.jsp">
<forward name="success" path="/jsp/tareWeightResult.jsp" />
<forward name="failure" path="/jsp/tareWeight.jsp" />
</action>
<action path ="/ExportToExcel"
type="com.astrazeneca.usbod.scale.actions.ExportTareToExcelAction">
<forward name="success" path="/jsp/tareWeightResult.jsp"/>
<forward name="failure" path="/jsp/tareWeight.jsp" />
</action>
GetTareByBarcodeAction
实际设置的属性如下。
request.getSession().setAttribute("TAREWEIGHT", tareWeightList);
tareWeightResult.jsp显示属性TAREWEIGHT
的内容。现在,我把一个按钮,在tareWeightResult.jsp
,这时候点击属性TAREWEIGHT
的内容应该被发送到如下一个动作形式,
<html:link forward="exportToExcel">Excel</html:link>
而在ExportTareToExcelAction.java文件,我有以下的代码,
List tareWeights = (List) request.getSession().getAttribute("TAREWEIGHT");
在这里,我无法获得该属性。它将空值返回到列表tareWeights
。
请让我知道什么是应该做的事在ExportTareToExcelAction.java
检索attibute内容...