Struts2 中,action中的result的各种转发类型

来源:互联网 发布:搞怪修图软件 编辑:程序博客网 时间:2024/04/27 13:50

多种结果转发类型:

一、dispatch(默认值):内部请求转发  例:

<result name="success">/WEB-INF/page/hello.jsp</result>

二、redirect:浏览器重定向,

<action name="redirect"><result type="redirect">/employeeAdd.jsp</result>   //employeeAdd.jsp在WebContent中;</action>

三、redirectAction:重定向action;

重定向同一个包里的action 中去,redirect 为同一个包里的另一个action名称

<action name="redirectAction" ><result type="redirectAction">redirect</result></action>

重定向不同一个包里的action 中去,

<action name="redirectOtherAction" ><span style="white-space:pre"></span><result type="redirectAction"><param name="actionName">otherAction</param><span style="white-space:pre"></span><param name="namespace">/test2</param></result></action>


四、plainText:输出视图的源代码

<action name = "plainText"><result type="plainText"><param name="location">/employeeAdd.jsp</param><param name="charSet">UTF-8</param>   <!-- 指定读取文件的编码格式 --></result></action>

0 0