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>
解决方案 »
- 现在ssh都用什么版本的,还有开发工具等?
- 关于代码的重构问题!!设计模式~原则!!谢谢
- 请教一个ajax+JSP登录程序的问题
- 如何使用java实现RBAC
- jsp中怎样把从数据空查询文字转换成图片
- 急:请问tomcat配置好了后,http://localhost:8084/为什么老看不见小猫??在线等....
- 求助:JSTL环境出错!
- jbuild中开发ejb时client程序如何写?
- 小弟初学,却被各种教程,概念搞的很糊涂
- 为什么我从http://www.jboss.org 下载下来的JBoss3.X版,解压后运行老是出错
- 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处理结果不会丢失。