一。Chain Result:
这个result调用另外的一个action,链接本身的拦截器栈和result。web
Redirect Action Result:
这个Result使用 ActionMapperFactory提供的ActionMapper来重定位浏览器的URL来调用指定的action和(可选 的)namespace. 这个Result比ServletRedirectResult要好.由于你不须要把URL编码成xwork.xml中配置的ActionMapper提 供的模式. 这就是说你能够在任意点上改变URL模式而不会影响你的应用程序. 所以强烈推荐使用这个Result而不是标准的redirect result来解决重定位到某个action的状况.浏览器
Redirect Result
调 用{@link HttpServletResponse#sendRedirect(String) sendRedirect}方法来转到指定的位置. HTTP响应被告知使浏览器直接跳转到指定的位置(产生客户端的一个新请求). 这样作的结果会使刚刚执行的action(包括action实例,action中的错误消息等)丢失, 再也不可用. 这是由于action是创建在单线程模型基础上的. 传递数据的惟一方式就是经过Session或者能够为Ognl表达式的web参数(url?name=value)app
二。当使用type=“redirectAction” 或type=“redirect”提交到一个action而且须要传递一个参数时。这里是有区别的:
a.使用type=“redirectAction”时,结果就只能写Action的配置名,不能带有后缀:“.action”
Java代码jsp
<action name="Login" class="steven.actions.LoginAction">
<result name="success" type="redirectAction">User?u_id=${loginBean.u_id}</result>
</action>编码
b.使用type=“redirect”时,结果应是action配置名+后缀名
Java代码
url
<action name="Login" class="steven.actions.LoginAction">
<result name="success" type="redirect">User.action?u_id=${loginBean.u_id}</result>
</action> spa
ps:1 redirect:action处理完后重定向到一个视图资源(如:jsp页面),请求参数所有丢失,action处理结果也所有丢失。
2 redirect-action:action处理完后重定向到一个action,请求参数所有丢失,action处理结果也所有丢失。
3 chain:action处理完后转发到一个action,请求参数所有丢失,action处理结果不会丢失。.net