多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] # type可取的值 ![](https://box.kancloud.cn/66a5dc51c35bd2fde1a0cedb000aff5c_1918x466.png) 默认值是dispatcher 它代表的是请求转发。针对于jsp页面 redirect 它代表的是重定向 针对于jsp页面 chain 它类似于请示转发,只不过它是针对于action跳转. redirectAction 它类似于重定向 针对于action ![](https://box.kancloud.cn/87d18ae240d8ae33f6da54af5f8cc3b3_1324x392.png) # 转发 ~~~ <action name="HelloAction" class="domain.HelloAction" method="hello"> <result name="success" type="dispatcher">/hello.jsp</result> </action> ~~~ # 重定向 url会变 ~~~ <package name="hello" namespace="/hello" extends="struts-default" > <action name="HelloAction" class="domain.HelloAction" method="hello"> <result name="success" type="redirect">/hello.jsp</result> </action> </package> ~~~ # 转发到Action ~~~ <package name="hello" namespace="/hello" extends="struts-default" > <action name="HelloAction" class="domain.HelloAction" method="hello"> <result name="success" type="redirect">/hello.jsp</result> </action> <action name="ShowAction" class="domain.HelloAction" method="show"> <result name="success" type="chain"> <param name="actionName">HelloAction</param> <param name="namespace">/hello</param> </result> </action> </package> ~~~ # 重定向到Action ~~~ <package name="hello" namespace="/hello" extends="struts-default"> <action name="HelloAction" class="domain.HelloAction" method="hello"> <result name="success" type="redirect">/hello.jsp</result> </action> <action name="ShowAction" class="domain.HelloAction" method="show"> <result name="success" type="redirectAction"> <param name="actionName">HelloAction</param> <param name="namespace">/hello</param> </result> </action> </package> ~~~