1. Action return string (logical view name)
<action> find logical view names in elements corresponding to local <result>
If local <result> does not exist, it looks for global <result> (some global <global-result> can be defined in each package)
* If local <result> and global <global-result> are not found no result defined for XXX
2. Configuration <result> Each result has two properties name and type
Default Type property value Dispatcher
<result-type name= "Dispatcher" class= "Org.apache.struts2.dispatcher.ServletDispatcherResult" default= "true"/ > action forwarded to the results page
* Request.setattribute (Name,value);
* Request.getRequestDispatcher.forward ();
<result-type name= "redirect" class= "Org.apache.struts2.dispatcher.ServletRedirectResult"/> Action Redirect to results page Cannot pass properties in Request
<result-type name= "redirectaction" class= "Org.apache.struts2.dispatcher.ServletActionRedirectResult"/> Actioon Redirect to another action
* name= "redirectaction" and Name= "redirect" differ in configuration
Struts2 page Layout supports JSP, Freemarker, Velocity and other technologies
<result-type name= "Freemarker" class= "Org.apache.struts2.views.freemarker.FreemarkerResult"/> Result set using Freemarket technology
<result-type name= "Velocity" class= "org.apache.struts2.dispatcher.VelocityResult"/> result set using velocity
<result-type name= "Stream" class= "org.apache.struts2.dispatcher.StreamResult"/> File download
In enterprise development, STRUTS2 provides good AJAX support, defining the result set type= "JSON"
3. Use forwarding and redirection
<result>/demo1.jsp</result>----By default by forwarding access to demo1.jsp
<result type= "redirect" >/demo1.jsp</result>-----with redirected access to demo1.jsp
Use of Redirectaction
<action name= "redirect" class= "Cn.itcast.struts2.demo7.RedirectActionDemo" >
<result type= "Redirectaction" >
<param name= "ActionName" >hello2</param>
<param name= "namespace" >/demo2</param>
</result>
</action>
Processing result configuration for Java EE----action