<result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
<result-type name="postback" class="org.apache.struts2.dispatcher.PostbackResult" />
</result-types>
dispatcher
success
extend-default
ActionSupport
这些是默认的类型
今天说说 struts.xml 转发类型
chain action 链表
dispatcher 转发 jsp
freemarker freemarker 模板作为视图
httpheader 特别的http
redirect 跳转其他url
redirectAction 跳转action
stream 放回inputStream 用于下载
velocity velocity 视图模板
xslt xml xslt 整合
plainText 显示源码
eg: <action name="pp" class="com.qh.action.LoginAction">
<result type="plainText">/success.jsp</result>
</action>
对于有中文一定要声明charSet
eg:
<action name="pp" class="com.qh.action.LoginAction">
<result type="plainText">
<param name="location">/success.jsp</param>
<param name="charSet">UTF-8</param>
</result>
</action>