zoukankan      html  css  js  c++  java
  • web.xml

    web项目启动时,

    容器(Tomcat)加载web.xml

    加载顺序

    <context-param>

    由于ContextLoaderListener加载时,会查找名为contextConfigLocation的参数.

    因此,配置context-param时参数名字应该是contextConfigLocation.

    所以context-param参数的名字是固定的contextConfigLocation.

    <listener>

    <filter>

    <servlet>

    1 <context-param>
    2     <param-name>contextConfigLocation</param-name>
    3     <param-value>classpath:spring-config.xml</param-value>
    4 </context-param>
    1 <listener>
    2         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    3 </listener>
     1     <!-- Spring字符集过滤器 -->
     2     <filter>
     3         <filter-name>characterEncoding</filter-name>
     4         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
     5         <!-- 设置request所指定字符集 -->
     6         <init-param>
     7             <param-name>encoding</param-name>
     8             <param-value>UTF-8</param-value>
     9         </init-param>
    10         <!-- 设置response所指定字符集 -->
    11         <init-param>
    12             <param-name>forceEncoding</param-name>
    13             <param-value>true</param-value>
    14         </init-param>
    15     </filter>
    16     <!-- filter过滤规则 -->
    17     <filter-mapping>
    18         <filter-name>characterEncoding</filter-name>
    19         <url-pattern>/*</url-pattern>
    20     </filter-mapping>
     1     <servlet>
     2         <servlet-name>dispactherServlet</servlet-name>
     3         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     4         <init-param>
     5             <param-name>contextConfigLocation</param-name>
     6             <param-value>/WEB-INF/spring-mvc.xml</param-value>
     7         </init-param>
     8 
     9         <load-on-startup>1</load-on-startup>
    10     </servlet>
    11 
    12     <servlet-mapping>
    13         <servlet-name>dispatcherServlet</servlet-name>
    14         <url-pattern>/</url-pattern>
    15     </servlet-mapping>
  • 相关阅读:
    Mysql数据库再度使用
    搭建wamp php环境
    phpMyAdmin
    windows激活全系列
    web常见之音乐播放器
    web常见效果之轮播图
    ASP.NET Web Pages
    Eclipse配置中文(汉化)
    以有涯随无涯
    How to get the edited text from itext in fabricjs
  • 原文地址:https://www.cnblogs.com/tongs/p/7481392.html
Copyright © 2011-2022 走看看