2012/8/4Action中result的各种转发类型
2012-08-04 19:45
260 查看
①在struts2中提供了多种result类型,常用的类型有:dispatcher(默认值)、redirect、redirectAction、plainText
②在result中还可以使用${属性名}表达式访问action中的属性,表达式里的属性名对应action中的属性。如下:
<result name="success" type="redirect">/employeeAdd.jsp?username=${username}</result>
③下面是redirectAction结果类型的例子,如果重定向的action在同一个包下:
<result type="redirectAction">helloworld</result>
④如果重定向的action在别的命名空间下:
<result type="redirectAcion">
<param name="actionName">helloworld</param>
<param name="namespace">/test<param>
<result>
⑤plaintext显示原始文件内容,例如:当我们需要显示jsp文件源代码的时候,我们可以使用此类型。
<action name="plainText">
<result type="plainText">
<param name="location">/index.jsp</param>
<param name="charSet">UTF-8</param> <!-- 指定读取文件的编码 -->
</result>
</action>
②在result中还可以使用${属性名}表达式访问action中的属性,表达式里的属性名对应action中的属性。如下:
<result name="success" type="redirect">/employeeAdd.jsp?username=${username}</result>
③下面是redirectAction结果类型的例子,如果重定向的action在同一个包下:
<result type="redirectAction">helloworld</result>
④如果重定向的action在别的命名空间下:
<result type="redirectAcion">
<param name="actionName">helloworld</param>
<param name="namespace">/test<param>
<result>
⑤plaintext显示原始文件内容,例如:当我们需要显示jsp文件源代码的时候,我们可以使用此类型。
<action name="plainText">
<result type="plainText">
<param name="location">/index.jsp</param>
<param name="charSet">UTF-8</param> <!-- 指定读取文件的编码 -->
</result>
</action>
相关文章推荐
- struts2之Action配置的各项默认值、result配置的各种视图转发类型及为应用指定多个struts配置文件
- struts.xml配置文件中action中的result的各种转发类型
- struts2的框架解析第5篇action中result的各种转发类型
- Action中result的各种转发类型
- Struts2:Action中result的各种转发类型
- struts2之Action配置的各项默认值、result配置的各种试图转发类型及为应用指定多个struts配置文件
- 传智Struts2笔记(四)Action中result的各种转发类型
- Struts2 中,action中的result的各种转发类型
- Struts2_Action中result的各种转发类型
- struts2之Action配置的各项默认值、result配置的各种试图转发类型及为应用指定多个struts配置文件
- 【Struts2学习笔记(2)】Action配置中的各项默认值和Action中result的各种转发类型
- <Action>中<result>的各种转发类型
- Action中result的各种转发类型
- struts2之Action配置的各项默认值、result配置的各种试图转发类型及为应用指定多个struts配置文件
- struts2之Action配置的各项默认值、result配置的各种试图转发类型及为应用指定多个struts配置文件
- Action中result的各种转发类型:
- Action中result的各种转发类型
- struts2教程:5、Action中result的各种转发类型
- 【Struts2学习笔记(2)】Action默认值和配置Action于result各种转发类型
- 【Struts2】④Action中result的各种转发类型