struts2支持的结果类型

     <action name="*Action_*" class="com.vrv.paw.action.{1}Action" method="{2}">
            <result name="{2}" type="dispatcher">/WEB-INF/pages/{1}Action/{2}.jsp</result>
        </action>

struts2默认的结果类型就是dispatcher

Struts2默认提供了一系列的结果类型,在struts2-core-x.x.x.jar包中struts-default.xml中

    <result-types>
            <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>

struts2内建的支持结果类型如下:
chain :Action链式处理的结果类型
dispatcher :用于指定使用JSP作为视图的结果类型
freemarker :用于指定使用FreeMarker模板作为视图的结构类型
httpheader :用于控制特殊的HTTP行为的结构类型
redirect :用于直接跳转其他URL的结果类型
redirectAction :用于直接跳转到其他Action的结果类型
stream :用于向浏览器返回一个InputStream(一般用于文件下载)
velocity :用于指定使用Velocity模板作为视图的结果类型
xslt :用于与XML/XSLT整合的结果类型
plainText :用于显示某个页面的原始代码的结果类型

原文地址:https://www.cnblogs.com/liaojie970/p/5122308.html