Explain:
To jump to another action with <result>, the original configuration code is:
<action name= " Insertdept " class= method=>
<result name= "success" type = "redirect-action" >selectdept </result>
</ACTION>
My struts version is 2.2.1, it is possible that the 2.0 version of the action configuration method has been modified, so the original configuration mode does not work. The changes are as follows:
<action Name="Insertdept" Class="Struts.org.db.DeptAction" Method="Insertdept">
<result Name="Success" type = " redirectaction " >
<param name Span class= "pun" >= " ActionName " > selectdept </PARAM>
</RESULT>
</ACTION>
<package name= "Pack1" namespace= "/test1 " extends= "Struts-default" >
<action name= "A" class= "xxx" >
<result type= "redirectaction" >
<param name= "ActionName" >B</param>
<param name= "namespace" >/test2</param>
</result>
</action>
</package>
<package name= "Pack2" namespace= "/test2 " extends= "Struts-default" >
<action name= "B" class= "yyy" method= "Addui" >
<result name= "Success" >
/web-inf/test.jsp
</result>
</action>
</package>
Description: The above code is used to jump from an action named "a" to an action named "B" and execute the "Addui" method in action. Two action in a different package.
method Two examples:
<action name= "A" class= "xxxx" >
<result name= "Success" type= "Chain">
<param name= "ActionName" >B</param>
<!--If you need a namespace--
<param name= "namespace" >/xxx</param>
<!--If you need a parameter jump, make sure that there are get methods and set methods in two classes--
<param name= "xxx" >${xxx}</param>
</result>
</action>
<!--write the method property on this class, that's how you access it--
<action name= "B" class= "xxxx" method= "xxxx" >
<result name= "Success" >/index.jsp</result>
</action>
STRUTS2 configuration of a struts.xml file that jumps from one action to another action