This page last changed on Oct 23, 2004 by plightbo.

基本配置文件webwork-default.xml包含在webwork的jar文件中. 该文件可以包含在xwork.xml 中以便包含标准的配置信息而无需复制, 如下:

<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd"><xwork>
   <include file="webwork-default.xml"/>    
    
   <package name="default" extends="webwork-default">
    ...
    </package>
</xwork>

2.1.5版本的webwork-default.xml内容如下:

<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd">

<xwork>
    <package name="webwork-default">
        <result-types>
            <result-type name="dispatcher" class="com.opensymphony.webwork.dispatcher.ServletDispatcherResult" default="true"/>
            <result-type name="redirect" class="com.opensymphony.webwork.dispatcher.ServletRedirectResult"/>
            <result-type name="velocity" class="com.opensymphony.webwork.dispatcher.VelocityResult"/>
            <result-type name="chain" class="com.opensymphony.xwork.ActionChainResult"/>
            <result-type name="xslt" class="com.opensymphony.webwork.views.xslt.XSLTResult"/>
            <result-type name="jasper" class="com.opensymphony.webwork.views.jasperreports.JasperReportsResult"/>
            <result-type name="freemarker" class="com.opensymphony.webwork.views.freemarker.FreemarkerResult"/>
            <result-type name="httpheader" class="com.opensymphony.webwork.dispatcher.HttpHeaderResult"/>
            <result-type name="stream" class="com.opensymphony.webwork.dispatcher.StreamResult"/>
        </result-types>

        <interceptors>
            <interceptor name="timer" class="com.opensymphony.xwork.interceptor.TimerInterceptor"/>
            <interceptor name="logger" class="com.opensymphony.xwork.interceptor.LoggingInterceptor"/>
            <interceptor name="chain" class="com.opensymphony.xwork.interceptor.ChainingInterceptor"/>
            <interceptor name="static-params" class="com.opensymphony.xwork.interceptor.StaticParametersInterceptor"/>
            <interceptor name="params" class="com.opensymphony.xwork.interceptor.ParametersInterceptor"/>
            <interceptor name="model-driven" class="com.opensymphony.xwork.interceptor.ModelDrivenInterceptor"/>
            <interceptor name="component" class="com.opensymphony.xwork.interceptor.component.ComponentInterceptor"/>
            <interceptor name="token" class="com.opensymphony.webwork.interceptor.TokenInterceptor"/>
            <interceptor name="token-session" class="com.opensymphony.webwork.interceptor.TokenSessionStoreInterceptor"/>
            <interceptor name="validation" class="com.opensymphony.xwork.validator.ValidationInterceptor"/>
            <interceptor name="workflow" class="com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor"/>
            <interceptor name="servlet-config" class="com.opensymphony.webwork.interceptor.ServletConfigInterceptor"/>
            <interceptor name="prepare" class="com.opensymphony.xwork.interceptor.PrepareInterceptor"/>
            <interceptor name="conversionError" class="com.opensymphony.webwork.interceptor.WebWorkConversionErrorInterceptor"/>
            <interceptor name="fileUpload" class="com.opensymphony.webwork.interceptor.FileUploadInterceptor"/>
            <interceptor name="execAndWait" class="com.opensymphony.webwork.interceptor.ExecuteAndWaitInterceptor"/>

            <!-- Basic stack -->
            <interceptor-stack name="defaultStack">
                <interceptor-ref name="servlet-config"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="static-params"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="conversionError"/>
            </interceptor-stack>

            <!-- Sample validation and workflow stack -->
            <interceptor-stack name="validationWorkflowStack">
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="validation"/>
                <interceptor-ref name="workflow"/>
            </interceptor-stack>

            <!-- Sample file upload stack -->
            <interceptor-stack name="fileUploadStack">
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

            <!-- Sample Inversion of Control stack -->
            <interceptor-stack name="componentStack">
                <interceptor-ref name="component"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

            <!-- Sample model-driven stack  -->
            <interceptor-stack name="modelDrivenStack">
                <interceptor-ref name="model-driven"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

            <!-- Sample action chaining stack -->
            <interceptor-stack name="chainStack">
                <interceptor-ref name="chain"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

            <!-- Sample execute and wait stack.
                 Note: execAndWait should always be the *last* interceptor. -->
            <interceptor-stack name="executeAndWaitStack">
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="execAndWait"/>
            </interceptor-stack>

            <!-- A complete stack with all the common interceptors in place.
                 Generally, this stack should be the one you use, though it
                 may process additional stuff you don't need, which could
                 lead to some performance problems. Also, the ordering can be
                 switched around (ex: if you wish to have your components
                 before prepare() is called, you'd need to move the component
                 interceptor up -->
            <interceptor-stack name="completeStack">
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="servlet-config"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="model-driven"/>
                <interceptor-ref name="component"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="static-params"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation"/>
                <interceptor-ref name="workflow"/>
            </interceptor-stack>
        </interceptors>
    </package>
</xwork>

文件中定义了全部缺省结果和截取器, 还定义了一些截取器栈供你直接使用或作为特定截取器栈的基础. 注意: 包名字是"webwork-default".

Document generated by Confluence on Dec 14, 2004 16:37