初识Struts2_常用结果类型
一、配置文件
1 <package name="default" namespace="/" extends="struts-default"> 2 <!-- 3 访问的url: 4 localhost:8080/Struts2_ResultType/r1 5 localhost:8080/Struts2_ResultType/r2 6 localhost:8080/Struts2_ResultType/r3 7 localhost:8080/Struts2_ResultType/r4 8 localhost:8080/Struts2_ResultType/r5 9 --> 10 <!-- 转发到jsp --> 11 <action name="r1"> 12 <result type="dispatcher">/r1.jsp</result> 13 </action> 14 <!-- 重定向到jsp --> 15 <action name="r2"> 16 <result type="redirect">/r2.jsp</result> 17 </action> 18 <!-- 转发到action --> 19 <action name="r3"> 20 <result type="chain">r1</result> 21 </action> 22 <!-- 重定向到action --> 23 <action name="r4"> 24 <result type="redirectAction">r2</result> 25 </action> 26 <!-- 重写向到别一个package的action --> 27 <action name="r5"> 28 <result type="redirectAction"> 29 <param name="actionName">x4</param> 30 <param name="namespace">/</param> 31 </result> 32 </action> 33 </package> 34 <package name="xxx" namespace="/" extends="struts-default"> 35 <action name="x4"> 36 <result>/r3.jsp</result> 37 </action> 38 </package>