Struts2基础之九:result的服务器跳转和客户端跳转
2012-10-14 22:34
423 查看
struts.xml 中配置action返回结果的方式:
其中chain方式,如果要跳转到其他包内的action比较麻烦,要多配置一个参数:
一:跳转到页面
如果<result>标签没有指定type的话,默认是<result type="dispatcher">,也就是服务器端页面跳转<!-- 1:服务器端跳转 --> <!-- 跳转后URL显示:还是action名(不变) --> <action name="hello1"> <result type="dispatcher"> /helloStruts2.jsp </result> </action> <!-- 2:客户端跳转 --> <!-- 跳转后URL显示:下边的jsp名(变为映射的jsp名) --> <action name="hello2"> <result type="redirect"> /helloStruts2.jsp </result> </action>
二:跳转到其他action
<!-- 1:服务器端跳转到目的action --> <!-- 跳转后URL显示:所请求的action名(不随跳转变) --> <action name="hello3"> <result type="chain"> hello1 </result> </action> <!-- 2:客户端跳转到目的action --> <!-- 跳转后URL显示:目的action的jsp名(变为映射的jsp名) --> <action name="hello4"> <result type="redirectAction"> hello1 </result> </action>
其中chain方式,如果要跳转到其他包内的action比较麻烦,要多配置一个参数:
<result type="chain"> <param name="actionName">dashboard</param> <param name="namespace">/secure</param> </result>
三:其他方式
还有stream方式(下载时候要配置),FreeMarker等方式,日后用到时候再来补充相关文章推荐
- struts2服务器跳转和客户端跳转之区别
- struts2的服务器跳转、客户端跳转、跳转类型
- struts2 result类型和客户端跳转,服务器端跳转
- struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)_forever
- Struts2不配置result参数 进行跳转实现
- mongodb基础系列——mongodb服务器与客户端安装
- struts2 Result类型(跳转)
- struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)_forever
- Linux 网络编程基础(一) ---------------客户端/服务器的简单实现
- 系统架构师-基础到企业应用架构-客户端/服务器
- Nginx根据客户端版本号跳转至后台相应服务器
- struts2跳转类型result type=chain/dispatcher/redirect
- Java基础知识强化之网络编程笔记10:TCP之客户端读取文本文件服务器控制台输出
- struts2注解@Result的几个跳转方式说明
- Android基于客户端和服务器的Socket编程例子之Socket基础通讯--socket相关知识
- 【struts2】action里result到action之间的跳转、不同包package
- struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)
- Nginx根据客户端版本号跳转至后台相应服务器
- struts2跳转类型result type=chain/dispatcher/redirect
- struts2基础学习收录重点之OGNL动态配置result , 使用注解配置action,实现java国际化