struts2 -result 中的 redirect 和 redirectAction 的 区别

redirect 结果类型:与 dispatcher 结果类型相对,dispatcher 结果类型是将请求 forward(转发)到指定的 jsp 资源:而 redirect 结果类型,则意味着将请求redirect(重定向)到指定的视图资源.

dispatcher 结果类型 与 redirect 结果类型的差别主要就是转发和重定向的差别:重定向会丢失所有的请求参数、请求属性.

redirectAction 结果类型:当需要让一个 Action处理结束后,直接将请求重定向到另一个 Action时,使用此类型结果.

eg:

使用 redirectAction 结果类型时,系统将重新生成一个新请求,只是该请求的 url 不是一个具体的 视图资源,而是另一个 Action.一次前一个Action 处理结果、请求参数、请求属性都会丢失.

对于 redirect 和 redirectAction 两种结果类型,都是重新生成一个新请求,区别是前者通常用于生成一个对具体资源的请求,而后者通常用于生成对另一个 Action 的请求,2个结果类型都会丢失请求参数、请求属性和前一个 Action 的处理结果.

时间: 2024-08-29 09:22:04

struts2 -result 中的 redirect 和 redirectAction 的 区别的相关文章

struts2 中chain、redirect、redirect-action的区别

struts2 中chain.redirect.redirectaction的区别 文章摘要: 一.Chain Result:这个result调用另外的一个action,连接自己的拦截器栈和result. ?actionName (默认) - 被调用的action的名字?namespace - 被调用的action的名称空间. 如果名称空间为空,这默认为当前名称空间?method - 用于指定目标action的另一个方法被调用. 如果空,默认为excute方法Redirect Action Re

redirect和redirectAction的区别

a.使用type="redirectAction"时,结果就只能写Action的配置名,不能带有后缀:".action" b.使用type="redirect"时,结果应是action配置名+后缀名 来自为知笔记(Wiz)redirect和redirectAction的区别,布布扣,bubuko.com

struts2.xml 中result type属性说明

chain           用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息.           com.opensymphony.xwork2.ActionChainResult       dispatcher           用来转向页面,通常处理JSP           org.apache.struts2.dispatcher.ServletDispatcherResult       freemaker           处理Fr

struts2中注解redirect时传递参数中文乱码问题解决方法

试过了很多方法  tomcat 编码  .字符串转换编码 .URLEncoder  .. 但是都没解决,后来仔细看了   struts2 的redirect ,redirectAction , 加上 params={"encode","true"} 就不会有乱码了 @Action(value = "/backend/deleteApplyInfoOfAuditById", results = { @Result(name = "succ

上struts2的xml在<result type="redirect">参数问题

今天做项目,我遇到了一个精彩的问题. 我需要在struts的xml中的<action>的<result>中配置type="redirect".同一时候须要传參进去.试了老半天.我的别的參数都好着,就flag參数不好,纠结死了都快.后来,突然想想.改一下,说不定是什么keyword之类的,就把flag改成了showflag了.居然奇迹般的好了! ! ! 特此记录.有类似问题的大家还是不要直接写flag比較好. <result name="succe

struts2 开发中,一些功能需要在struts.xml中的配置

1.普通package <!-- package元素: * name:为当前包起名 作用,用于继承 * namespace:命名空间,相当于一个房间号:我们需要对号入座 * extends:当使用action的时候,必须继承struts-default,如果不继承,struts2定义的所有方法将失效--> <package name="primer" namespace="/primer" extends="struts-default&

struts2 result的type属性

目前只使用过以下3种,都是直接跳转到另一个action  chain: 写法:<result name="success" type="chain">nextAction</result> nextAction前面不加[/]斜线,上一个action中request中设置的值,在nextAction中可以取到 redirect: 写法:<result name="success" type="redirect

result中type的几种类型

result中type的几种类型 dispatch:type的默认类型,相当于servlet的forward方式跳转页面,且只能是页面不能是action,页面能拿到值: redirect:页面重定向,客户端跳转,可以是页面也可以是action,地址栏发生变化,页面不能拿到值,由于redirect采取重定向的方式,下一个页面会取不到上一个请求对象里面的值,如果要传值的话,可以采用get的方式传参: redirect-action:客户端跳转到另一个action,action不能通过get拿到值:

struts2.0中Action的对象生命周期详解!!(转)

原文出处:http://blog.csdn.net/wxy_g/article/details/2071662 有很多人问Struts2.0中的对象既然都是线程安全的,都不是单例模式,那么它究竟何时创建,何时销毁呢? 这个和struts2.0中的配置有关,我们来看struts.properties ### if specified, the default object factory can be overridden here ### Note: short-hand notation is