读书人

action配备的默认值视图的各种转发类

发布时间: 2012-11-03 10:57:44 作者: rapoo

action配置的默认值,视图的各种转发类型

一.Action配置的各项默认值:

<!-- action配置的各项默认值 class默认为ActionSupportmethod默认为action中的execute()方法--><action name="xxx" method="execute"><!-- result配置中的默认值name属性默认为"success" type属性默认为dispatcher,即内部请求转发方式--><result name="success" type="dispatcher">/WEB-INF/page/hello.jsp</result></action>
?

二.result的类型(视图的转发类型)

dispatcher:内部请求转发方式(默认值)

redirect:重定向(此时重定向的视图页面不能位于WEB-INF目录下,一定要浏览器能够直接访问的页面)

<result name="success" type="redirect">/hello.jsp</result>?

redirectAction:重定向到某个action

<!-- 如果Action位于统一个包下 --><result type="redirectAction">actionName</result><!-- 如果Action位于不同的包下 --><result type="redirectAction"><param name="actionName">actionName</param><param name="namespace">namespace</param></result>
??

?

读书人网 >Web前端

热点推荐