(转)Struts2中返回类型redirect和redirectAction有什么区别

当使用type=“redirectAction” 或type=“redirect”提交到一个action并且需要传递一个参数时。这里是有区别的:
使用type=“redirectAction”时,结果就只能写Action的配置名,不能带有后缀:“.action”
Java代码
       
<action name="Login" class="steven.actions.LoginAction"> 
     <result name="success" type=" <SPAN class=hilite1>redirect </SPAN>Action">

            User?u_id=${loginBean.u_id}

     </result> 
</action> 

   
<action name="Login" class="steven.actions.LoginAction">
  <result name="success" type="redirectAction">User?u_id=${loginBean.u_id} </result>
</action>


使用type=“redirect”时,结果应是action配置名+后缀名


Java代码
<action name="Login" class="steven.actions.LoginAction"> 
       <result name="success" type=" <SPAN class=hilite1>redirect </SPAN>">

             User.action?u_id=${loginBean.u_id}

       </result> 
</action> 

-----------------------------

chain  :login  //实际是login.do
dispatcher  :  login.jsp  //直接跳转
redirect  :  index.html  //重新跳转。比如我提交的是xx。do 执行完了就跳转去index。html
              不用这个的话,url还是停留在xx。do的。容易被反复刷新 重复提交。

 

链接自: http://www.114java.com/javakaiyuankuangjia/struts2_0/200911/713.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值