struts2 action 之间的跳转
从action1直接跳转到action2,有两种方法:
1. 需要保存前一个action的属性信息时使用,保存住action1的request对象:
<result type= "chain " name="a2">action2</result> 此处 action2 指action名称,无须带.action 或者.do
2. 不保存前一个action的参数可以用这种方法:
<result type= "redirectAction "> action2</result> 这个就需要 带上.action 名称
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="chemical" namespace="/chemical" extends="global"> <action name="*" class="com.sinocarbon.tbl.action.ChemicalAction" method="{1}"> <!--原材料输入输出--> <result name="addRawmaterial">/entp_pages/chemical/rawmaterial.jsp</result> <!--<result name="toEditRawmaterial" type="redirectAction">toEditRawmaterial.action?tblcode=12&reptid=3</result>--> <result name="toEditRawmaterial" type="chain">toEditRawmaterial</result> <!--碳酸盐使用过程产生的排放--> <result name="addCarbonate" >/entp_pages/chemical/carbonate.jsp</result> <result name="toEditCarbonate" type="chain">toEditCarbonate</result> <!--硝酸生产过程产生的排放--> <result name="addNitricacid">/entp_pages/chemical/nitricacid.jsp</result> <result name="toEditNitricacid" type="chain">toEditNitricacid</result> <!--已二酸生产过程产生的排放--> <result name="addAdipicacid">/entp_pages/chemical/adipicacid.jsp</result> <result name="toEditAdipicacid" type="chain">toEditAdipicacid</result> <!--回收外供的二氧化碳--> <result name="addSupplyco2">/entp_pages/chemical/supplyco2.jsp</result> <result name="toEditSupplyco2" type="chain">toEditSupplyco2</result> <result name="editRawmaterial">/entp_pages/chemical/editRawmaterial.jsp</result> <result name="editCarbonate">/entp_pages/chemical/editCarbonate.jsp</result> <result name="editNitricacid">/entp_pages/chemical/editNitricacid.jsp</result> </action> </package> </struts>