Java EE Development of various resources download list, the history of the most IT resources, personal collection summary.
When the same view is used in more than one action, we should define result as a global view. Similar functionality is also available in the global forward,struts2 provided in STRUTS1:
<package name= "Package1" >
<global-results>
<result name= "Message" >/message.jsp</result>
</global-results>
<action name= "Action1" ></action>
<action name= "Action2" ></action>
</package>
At this point, the action class for Action1 and Action2 under the Package1 package can access the message attempt. However, the <global-result> <result> in this area can only be shared under the same package, and if you want to share between different package, you may inherit another package B with one package a. Package A can use the global result and <action> defined in Pack B, and, of course, if you can overwrite <action> or <result> in the parent bundle B
such as: <package name= "Itstar" namespace= "/student" extends= "Struts-default";
<global-results>
<result type= "redirect" Name= "Success" >/SUCCESS.JSP</RESULT>
</global-results>
</package>
<package name= "Itcast" namespace= "/test" extends= " Itstar ";
<action name= "delete" class= "",
</action>
</package>
This time, in the browser input: Http://localhost:8080/test/delete, you can jump to the "/success.jsp" page.
Here <action name= "Delete" > does not write <result>, but the default values for the <action> and <result> properties are:
1> if no class or empty string is specified for the action, the default is Com.opensymphony.xwork2.ActionSupport.
2> If no method is specified for the action or is an empty string, the Execute () method in action is executed by default.
3> if the Name property of result is not specified or is an empty string, the default value is success.