当使用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