Struts.xml 中的11种Result-Type类型

来源:互联网 发布:杰科网络电视机顶盒r1 编辑:程序博客网 时间:2024/04/30 11:01

struts核心包版本:struts2-core-2.3.16.3.jar

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

总类型11种。

类型探究:

  1. dispatcher。请求转发。

【Note】:

  1. dispatcher只是请求转发,只能在本项目应用中使用,不能转发到外部资源。如果需要跨应用访问资源,需要使用重定向
0 0
原创粉丝点击