我在struts-config.xml文件中有下面的action mappings
。
<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将显示属性编辑器( attribute TAREWEIGHT
)的内容。现在,我在tareWeightResult.jsp
中放置了一个按钮,当单击该按钮时,属性TAREWEIGHT
的内容应发送到操作表单,如下所示。
<html:link forward="exportToExcel">Excel</html:link>
在ExportTareToExcelAction.java文件中,我有下面这段代码,
List tareWeights = (List) request.getSession().getAttribute("TAREWEIGHT");
在这里,我无法获得该属性。它将NULL值返回到列表tareWeights
。
请让我知道应该做些什么来检索ExportTareToExcelAction.java
中的属性内容...
发布于 2012-01-04 14:13:46
如果会话属性为null,则有五种可能性:
中存储了null
https://stackoverflow.com/questions/8727680
复制