Struts2-result类型
来源:互联网 发布:微信聊天数据迁移 编辑:程序博客网 时间:2024/05/24 00:28
Struts2 result类型
1.dispatcher:服务器跳转到页面,通常来处理JSP,默认类型。
2.redirect:重定向到页面。
Action:
1 public String redirect() { 2 message = "message中有值"; 3 return "redirect"; 4 }
struts.xml
1 <package name="chapter3" namespace="/chapter3" extends="struts-default"> 2 <action name="redirectAction" class="chapter3.action.Chapter3Action" method="redirect"> 3 <result name="redirect" type="redirect">/redirect.jsp</result> 4 </action> 5 </package>
注意的地方:外部中转不能带值过去,并且页面不能受保护
传参数:
1 <action name="redirectAction" class="chapter3.action.Chapter3Action" method="redirect"> 2 <result name="redirect" type="redirect">/redirect.jsp?message=${message}</result> 3 </action>
页面:
${param.message}<br>
3.chain:服务端跳转到Action;
action:
1 public String action2() { 2 message = "我是action2中设置的值"; 3 return "action2"; 4 }
struts.xml
1 <package name="chapter32" namespace="/chapter32" extends="struts-default"> 2 <action name="action2" class="chapter3.action.Chapter3Action" method="action2"> 3 <result name="action2" type="chain"> 4 <param name="actionName">redirectAction</param> 5 <param name="namespace">/chapter3</param> 6 </result> 7 </action> 8 </package>
4.redirectAction:外部跳转到Action;
action:
1 public String action3() { 2 message = "我是action3中设置的值"; 3 return "action3"; 4 }
struts.xml
1 <action name="action3" class="chapter3.action.Chapter3Action" method="action3"> 2 <result name="action3" type="redirectAction">redirectAction</result> 3 </action>
跨命名空间的外部跳转:
1 public String action4() { 2 message = "我是action4中设置的值"; 3 return "action4"; 4 }
struts.xml
1 <action name="action4" class="chapter3.action.Chapter3Action" method="action4"> 2 <result name="action4" type="redirectAction"> 3 <param name="actionName">redirectAction</param> 4 <param name="namespace">/chapter3</param> 5 </result> 6 </action>
0 0
- Struts2中的result类型
- struts2 result type类型
- struts2 result 类型
- struts2 result type 类型
- struts2 result类型
- struts2的Result类型
- Struts2 自定义Result类型
- Struts2 自定义Result类型
- struts2的Result类型
- Struts2:Result结果类型
- Struts2:Result类型
- Struts2-result类型
- struts2 Result 类型说明
- Struts2-result类型
- Struts2的Result类型
- struts2 result 类型
- struts2--result类型
- struts2.0 action result类型
- Android应用程序资源的编译和打包过程分析
- linux密码破解与开机加密
- 在Windows上, 为什么不要将select函数作为定时器?---因为经常返回WSAEINVAL
- C++ STL之排序函数详解
- 文件系统的扩展属性:xattr命令
- Struts2-result类型
- 软件工程师之一:奠定基础
- python学习——基础
- iOS应用性能调优的25个
- Struts2 Result详解
- T-kernel 版本确认
- Path SumII|leetcode题解
- 4.Java NIO系列教程之Scatter/Gather
- java错误,找不到标示符