zoukankan      html  css  js  c++  java
  • 2、Struts2引入多个配置文件

    1、关于核心配置文件 struts.xml

    <?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>
    
        <include file="com/baowei/action/userAction.xml" />
        <include file="constant.xml" />
    
    
    </struts>

    2、关于Action的配置文件Action.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
    
    <struts>
    
        <package name="mypackage" extends="struts-default">
    
    
            <!-- <action name="User_add" class="com.baowei.action.UserAction" method="add"> 
                <result name="add">/User/add.jsp</result> </action> <action name="User_delete" 
                class="com.baowei.action.UserAction" method="delete"> <result name="delete">/User/delete.jsp</result> 
                </action> -->
    
            <!-- <action name="User" class="com.baowei.action.UserAction"> <result 
                name="add">/User/add.jsp</result> </action> -->
    
    
            <action name="*_*" class="com.baowei.action.{1}Action" method="{2}">
                <result name="{2}">/{1}/{2}.jsp</result>
            </action>
    
    
        </package>
    
    
    </struts>

    3、关于struts2一些常量的配置文件constant.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
    
    <struts>
    
        <!-- 一、全局配置 -->
        <!-- 0. 请求数据编码 -->
         <constant name="struts.i18n.encoding" value="UTF-8"/>
        <!-- 1. 修改Struts默认的访问后缀 -->
        <constant name="struts.action.extension" value="action,do,"></constant>
        <!-- 2. 修改xml自动重新加载 -->
        <constant name="struts.configuration.xml.reload" value="true"/>
        <!-- 3. 开启动态方法调用 (默认不开启)-->
        <constant name="struts.enable.DynamicMethodInvocation" value="true"/>
        <!-- 4. 修改上传文件的最大大小为30M -->
        <constant name="struts.multipart.maxSize" value="31457280"/>
        
        
    </struts>
  • 相关阅读:
    [Redux] Extracting Container Components (FilterLink)
    [Regular Expressions] Introduction
    [Javascript] Web APIs: Persisting browser data with window.localStorage
    [Javascript] The JSON.stringify API
    [Redux] Extracting Presentational Components -- TodoApp
    [Redux] Extracting Presentational Components -- Todo, TodoList
    [Redux] Extracting Presentational Components -- Footer, FilterLink
    [Redux] Extracting Presentational Components -- AddTodo
    [Javascript] Task queue & Event loop.
    吸尘器:吸尘器
  • 原文地址:https://www.cnblogs.com/zhangbaowei/p/4883099.html
Copyright © 2011-2022 走看看