Struts2 中 Result的 Chain Result,Redirect Action Result,Redirect Result 三者之间的区别
来源:互联网 发布:数据洞察 编辑:程序博客网 时间:2024/04/30 06:11
Chain Result:
这个result调用另外的一个action,连接自己的拦截器栈和result。
- actionName (默认) - 被调用的action的名字
- namespace - 被调用的action的名称空间. 如果名称空间为空,这默认为当前名称空间
- method - 用于指定目标action的另一个方法被调用. 如果空,默认为excute方法
这个Result使用ActionMapperFactory提供的ActionMapper来重定位浏览器的URL来调用指定的action和(可选的)namespace. 这个Result比ServletRedirectResult要好.因为你不需要把URL编码成xwork.xml中配置的ActionMapper提供的模式. 这就是说你可以在任意点上改变URL模式而不会影响你的应用程序. 因此强烈推荐使用这个Result而不是标准的redirect result来解决重定位到某个action的情况.
- ActionName (默认) - 重定位到的action名
- namespace - action的名称空间. 如果为null,则为当前名称空间
调用{@link HttpServletResponse#sendRedirect(String) sendRedirect}方法来转到指定的位置. HTTP响应被告知使浏览器直接跳转到指定的位置(产生客户端的一个新请求). 这样做的结果会使刚刚执行的action(包括action实例,action中的错误消息等)丢失, 不再可用. 这是因为action是建立在单线程模型基础上的. 传递数据的唯一方式就是通过Session或者可以为Ognl表达式的web参数(url?name=value)
- location (默认) - action执行后跳转的地址.
- parse - 默认为true. 如果设置为false, location参数不会被当作Ognl表达式解析.
<result name="success" type="redirect">/displayCart.action?userId=${userId}</result>
------------
Chain result type is used for Action Chaining which means that the source result invokes an entire other action, complete with it's own interceptor stack and result.
Redirect Action result type is used to redirect to another Action which means making your source Action, after it has successfully executed, result in a redirect.
As a rule, Action Chaining is not recommended. Redirect Result or the Redirect Action Result is preferred over Chain Result.
====================================
Struts2中的<result></result>标签的属性type="redirect"与type="redirect-action"的区别,
type="redirect" 的值可以转到其它命名空间下的action,而redirect-action只能转到同一命名空下的 action,
因此它可以省略.action的后缀直接写action的名称。
- Struts2 中 Result的 Chain Result,Redirect Action Result,Redirect Result 三者之间的区别
- struts2 中配置result 中chain、redirect、redirectaction的区别
- struts2 中dispatcher、redirect和chain三种result type的使用区别
- struts2 中dispatcher、redirect和chain三种result type的使用区别
- Struts2 result type的redirect,redirectAction,chain的区别
- Struts2中result的type其中redirect,redirectAction,chain的区别
- struts2第一天基础配置 action package result 全局result redirect chain redirectAction
- dispatcher、redirect和chain三种result type的使用区别
- dispatcher、redirect和chain三种result type的使用区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 配置文件Struts.xml <result>中type属性 redirect,redirectAction,chain的区别
- 【转】struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)
- struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)
- struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)
- Windows CE 6.0 安装及相关注意事项2【转】
- 早年的一篇关于80286保护模式的文章
- java线程 --- 一道迅雷笔试题 (一)
- xen live migration
- 股市的两个凡是
- Struts2 中 Result的 Chain Result,Redirect Action Result,Redirect Result 三者之间的区别
- VC6下 try catch 在release下的杯具
- 开放式虚拟机格式OVF
- Django模板中使用css, javascript
- struts2中action跳转到另一个action的方法
- GDE-X进展 战场框架
- 迁移、重构项目的注意事项
- iomanip头文件常用函数汇总
- 绑定水晶报表的两种方式Pull和Push[vs2008环境]