<?xml version="1.0" encoding="UTF-8"?>
|
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
|
<!-- web.xml中加载顺序 context-param -> listener -> filter -> servlet -->
|
<context-param>
|
<param-name>webAppRootKey</param-name>
|
<param-value>webapp.root</param-value>
|
</context-param>
|
<context-param>
|
<param-name>log4jConfigLocation</param-name>
|
<param-value>WEB-INF/config/log4j.properties</param-value>
|
</context-param>
|
<!-- 设置Spring容器加载所有的配置文件的路径 -->
|
<context-param>
|
<param-name>contextConfigLocation</param-name>
|
<param-value>WEB-INF/config/spring-*.xml</param-value>
|
</context-param>
|
|
<listener>
|
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
</listener>
|
|
<!-- 加载Spring容器配置 -->
|
<listener>
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
</listener>
|
<listener>
|
<listener-class>
|
org.springframework.web.context.request.RequestContextListener
|
</listener-class>
|
</listener>
|
|
<!-- 配置SpringMVC核心控制器 -->
|
<servlet>
|
<servlet-name>springMVC</servlet-name>
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
<!-- 配置初始配置化文件-->
|
<init-param>
|
<param-name>contextConfigLocation</param-name>
|
<param-value>WEB-INF/config/servlet-mvc.xml</param-value>
|
</init-param>
|
<!-- 启动加载一次 -->
|
<load-on-startup>0</load-on-startup>
|
</servlet>
|
|
<!--为DispatcherServlet建立映射 -->
|
<servlet-mapping>
|
<servlet-name>springMVC</servlet-name>
|
<!-- 此处可以可以配置成*.do,对应struts的后缀习惯 -->
|
<url-pattern>/</url-pattern>
|
</servlet-mapping>
|
|
<!-- 防止Spring内存溢出监听器 -->
|
<listener>
|
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
|
</listener>
|
|
<!-- 解决工程编码过滤器 -->
|
<filter>
|
<filter-name>encodingFilter</filter-name>
|
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
<init-param>
|
<param-name>encoding</param-name>
|
<param-value>UTF-8</param-value>
|
</init-param>
|
<init-param>
|
<param-name>forceEncoding</param-name>
|
<param-value>true</param-value>
|
</init-param>
|
</filter>
|
|
<!-- 系统菜单过滤器 -->
|
<filter>
|
<filter-name>menuFilter</filter-name>
|
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
</filter>
|
|
<filter-mapping>
|
<filter-name>encodingFilter</filter-name>
|
<url-pattern>/*</url-pattern>
|
</filter-mapping>
|
|
<filter-mapping>
|
<filter-name>menuFilter</filter-name>
|
<url-pattern>/*</url-pattern>
|
<dispatcher>REQUEST</dispatcher>
|
<dispatcher>FORWARD</dispatcher>
|
</filter-mapping>
|
|
<welcome-file-list>
|
<welcome-file>/index.jsp</welcome-file>
|
</welcome-file-list>
|
|
<error-page>
|
<exception-type>java.lang.Throwable</exception-type>
|
<location>/error</location>
|
</error-page>
|
<error-page>
|
<error-code>500</error-code>
|
<location>/error?httpCode=500</location>
|
</error-page>
|
<error-page>
|
<error-code>404</error-code>
|
<location>/error?httpCode=404</location>
|
</error-page>
|
<error-page>
|
<error-code>405</error-code>
|
<location>/error?httpCode=405</location>
|
</error-page>
|
|
<jsp-config>
|
<taglib>
|
<taglib-uri>frame</taglib-uri>
|
<taglib-location>/WEB-INF/tld/frame.tld</taglib-location>
|
</taglib>
|
</jsp-config>
|
</web-app>
|