在Struts2中的结果类型。
1.dispatcher,就是直接页面跳转到jsp试图的。不再详细说明
2.chain
就是多个Action之间共同完成一个工作,先到一个Action中干一个活,再到宁外一个Action干另一个活。
<action name="testChain1" class="com.action.Action1">
<result type="chain">testChain2</result>
</action>
<action name="testChain2" class="com.action.Action2">
<result>/WEB-INF/showChainResult.jsp</result>
</action>
如果请求testChain1.action程序会在com.action.Action1的execute方法中执行,执行完之后会跳转到
testChain2.action对应的com.action.Action2的execute方法中执行,执行完事之后页面跳转到showChainResult.jsp中。
其中所有的url参数都会元封不变的传到第二个Action当中,即使第一个Action中没有写任何的参数字段也不例外。
还有就是Action1中setAttribute的值会传到Action2中 , 不管Action2中是不是有这个字段。
3.redirect
重定向,可定向到任意url,无值传递,所有的参数会传到Action中,但是在Action走过之后,再到另外的页面活其他的action时,所有的url参数消失,所有的setAttribute的值消失。
4.redirect-Action
重定向,只能重定向到Action,与redirect相同,到了其他Action中所有的url参数消失,所有的setAttribute值消失。