zoukankan      html  css  js  c++  java
  • Spring XML配置文件示例(二)——web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>tq</display-name>
        
        <!--log4j配置-->
        <context-param>
          <param-name>log4jConfigLocation</param-name>
          <param-value>classpath:log4j.properties</param-value>
       </context-param>
       <!--log4j配置-->
       <context-param>
          <param-name>log4jRefreshInterval</param-name>
          <param-value>6000</param-value>
       </context-param>
        <!--启动log4j-->
        <listener>
          <listener-class>
            org.springframework.web.util.Log4jConfigListener
          </listener-class>
       </listener> 
    
    
        <!-- Spring MVC配置 -->
        <servlet>
            <servlet-name>spring</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <!-- 可以自定义servlet.xml配置文件的位置和名称,默认为WEB-INF目录下,名称为[<servlet-name>]-servlet.xml,如spring-servlet.xml
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/spring-servlet.xml</param-value>&nbsp; 默认
            </init-param>
            -->
            <load-on-startup>1</load-on-startup>
        </servlet>
        
        <servlet-mapping>
            <servlet-name>spring</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
          
        
        <!-- Spring配置 -->
        <listener>
           <listenerclass>
             org.springframework.web.context.ContextLoaderListener
           </listener-class>
        </listener>
          
        <!-- 指定Spring Bean的配置文件所在目录。默认配置在WEB-INF目录下 -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:config/applicationContext.xml</param-value>
        </context-param>
    
    </web-app>
  • 相关阅读:
    C++中的friend函数详细解析(一)
    【图像处理算法】 直方图均衡化
    可降水量W:空中水文学名词初集(4)
    excel\docx
    WebService学习总结
    C#深入学习笔记Lock
    事件Event深入总结
    C#泛型委托与Lambda总结
    SQLServer事务与锁的基础概念总结
    委托Delegate深入总结
  • 原文地址:https://www.cnblogs.com/tq03/p/3598381.html
Copyright © 2011-2022 走看看