struts2几种常见的结果类型result_type
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <constant name="struts.devMode" value="true" /> <package name="resultTypes" namespace="/r" extends="struts-default"> <action name="r1"> <result type="dispatcher">/r1.jsp</result> </action> <action name="r2"> <result type="redirect">/r2.jsp</result> </action> <action name="r3"> <result type="chain">r1</result> </action> <action name="r4"> <result type="redirectAction">r2</result> <!-- <result type="redirectAction">r1</result> --> </action> </package></struts>
?
dispatcher:服务器内部转发,默认的.
?
redirect:客户端重定向.
?
chain:用于转发到另外的action,如果这个action在另处的package:使用下面写法?
<action name="login" class="..."> <!-- Chain to another namespace --> <result type="chain"> <param name="actionName">dashboard</param> <param name="namespace">/secure</param> </result> </action>
?路径显示是这个action
?
?
?
redirectAction:重定向到另外的action
?
?
?
?
?
?
?
?官方文档里有11种之多,其它的平时也很少用到,具体用法帮助文档有详细说明