Struts2 零配置文件

来源:互联网 发布:网络电玩游戏 编辑:程序博客网 时间:2024/05/22 14:37
<?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>
    <!-- Constants -->
    <constant name="struts.devMode" value="false"/>
    <constant name="struts.i18n.encoding" value="UTF-8"/>
    <constant name="struts.action.extension" value="do"/>
    <constant name="struts.objectFactory" value="spring"/>
    <constant name="struts.custom.i18n.resources" value="ApplicationResources,errors"/>
    <constant name="struts.multipart.maxSize" value="20971520"/>
    <constant name="struts.ui.theme" value="xxxx"/>
    <constant name="struts.enable.SlashesInActionNames" value="true"/>
    <constant name="struts.configuration.classpath.defaultParentPackage" value="default" />


    <!-- Configuration for the default package. -->
    <package name="default" extends="struts-default">
        <interceptors>
            <interceptor-stack name="defaultStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="alias"/>
                <interceptor-ref name="servlet-config"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="debugging"/>
                <interceptor-ref name="profiling"/>
                <interceptor-ref name="scoped-model-driven"/>
                <interceptor-ref name="model-driven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="static-params"/>
                <interceptor-ref name="params">
                    <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
            </interceptor-stack>
            <interceptor-stack name="fileUploadStack">
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
        </interceptors>


        <global-results>
            <result name="home" type="redirect">home.html</result>
            <result name="headFrame" type="redirect">headFrame.html</result>
            <result name="menuBar" type="redirect">menuBar.html</result>
            <result name="leftTop" type="redirect">leftTop.html</result>
            <result name="leftMain" type="redirect">leftMain.html</result>
            <result name="rightTop" type="redirect">rightTop.html</result>
            
            <result name="dataAccessFailure">/error/dataAccessFailure.jsp</result>
            <result name="error">/error/errorPage.jsp</result>
            
            <result name="custom">${forwardUrl}</result>
            <result name="custom2" type="redirect">${forwardUrl}</result>
            <result name="custom3" type="redirect-action">${forwardUrl}</result>
        </global-results>


        <global-exception-mappings>
            <exception-mapping exception="org.springframework.dao.DataAccessException" result="dataAccessFailure"/>
            <exception-mapping exception="java.lang.Throwable" result="error"/>
        </global-exception-mappings>
        
        <action name="home">
            <result name="success">/WEB-INF/pages/home.jsp</result>
        </action>
        <action name="headFrame">
            <result name="success">/WEB-INF/pages/common/headFrame.jsp</result>
        </action>
        <action name="menuBar">
            <result name="success">/WEB-INF/pages/common/menuBar.jsp</result>
        </action>
        <action name="leftTop">
            <result name="success">/WEB-INF/pages/common/leftTop.jsp</result>
        </action>
        <action name="leftMain">
            <result name="success">/WEB-INF/pages/common/leftMain.jsp</result>
        </action>
        <action name="rightTop">
            <result name="success">/WEB-INF/pages/common/rightTop.jsp</result>
        </action>
    </package>
</struts>
0 0
原创粉丝点击