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內容...