struts2没用过,借goole的花献你这个佛当使用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>
使用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>
解决方案 »
- JBOSS的2B问题。。老鸟来看看,谢谢了
- hibernate分页问题
- 高分求一个java mail 实例
- "空指针错误 java.lang.NullPointerException "
- HQL查询分组最大记录的问题
- java调用webServices出现如下错误,请大侠支招啊
- 如何实现有约束的RBAC模型?
- 文件无法打开
- 在线求解何错error:java.lang.ArithmeticException: / by zero
- rmi分布式应用的一个问题
- struts 和JSF哪个好?
- Struts Tiles 报 does not start with a "/" character 错误如何解决?
<interceptor-ref name="prepare" />
<interceptor-ref name="servlet-config" />
<interceptor-ref name="i18n" />
<interceptor-ref name="chain" />
<interceptor-ref name="debugging" />
<interceptor-ref name="model-driven" />
<interceptor-ref name="fileUpload" />
<interceptor-ref name="static-params" />
<interceptor-ref name="params" />
<interceptor-ref name="conversionError" />
<interceptor-ref name="validation">各个都要详细的了解,也不是几个字可以说明白给你的,你可以去搜索相关资料。我的话 主要就用几个:
chain :login //实际是login.do
dispatcher : login.jsp //直接跳转
redirect : index.html //重新跳转。比如我提交的是xx。do 执行完了就跳转去index。html
不用这个的话,url还是停留在xx。do的。容易被反复刷新 重复提交。
2》redirect-action:action处理完后重定向到一个action,请求参数全部丢失,action处理结果也全部丢失。
3》chain:action处理完后转发到一个action,请求参数全部丢失,action处理结果不会丢失。