|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
|
|
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
|
|
|
<display-name>Erudition</display-name>
|
|
|
|
|
|
<!--post乱码过滤器-->
|
|
|
<!-- 配置springMVC编码过滤器 -->
|
|
|
<filter>
|
|
|
<filter-name>CharacterEncodingFilter</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-mapping>
|
|
|
<filter-name>CharacterEncodingFilter</filter-name>
|
|
|
<url-pattern>/*</url-pattern>
|
|
|
</filter-mapping>
|
|
|
|
|
|
<!--加载spring容器-->
|
|
|
<context-param>
|
|
|
<param-name>contextConfigLocation</param-name>
|
|
|
<param-value>
|
|
|
classpath:spring/spring-*.xml,
|
|
|
</param-value>
|
|
|
</context-param>
|
|
|
|
|
|
<!--配置监听器,来加载spring容器-->
|
|
|
<listener>
|
|
|
<listener-class>
|
|
|
org.springframework.web.context.ContextLoaderListener
|
|
|
</listener-class>
|
|
|
</listener>
|
|
|
|
|
|
|
|
|
<!-- logback日志打印 -->
|
|
|
<context-param>
|
|
|
<param-name>logbackConfigLocation</param-name>
|
|
|
<param-value>classpath:logback.xml</param-value>
|
|
|
</context-param>
|
|
|
<listener>
|
|
|
<listener-class>ch.qos.logback.ext.spring.web.LogbackConfigListener</listener-class>
|
|
|
</listener>
|
|
|
|
|
|
<!--springmvc前端控制器 -->
|
|
|
<servlet>
|
|
|
<servlet-name>Erudition</servlet-name>
|
|
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
|
|
<init-param>
|
|
|
<param-name>contextConfigLocation</param-name>
|
|
|
<param-value>classpath:spring/spring-mvc.xml</param-value>
|
|
|
</init-param>
|
|
|
</servlet>
|
|
|
<servlet-mapping>
|
|
|
<servlet-name>Erudition</servlet-name>
|
|
|
<url-pattern>/</url-pattern>
|
|
|
</servlet-mapping>
|
|
|
|
|
|
<!--随时获得request-->
|
|
|
<listener>
|
|
|
<listener-class>
|
|
|
org.springframework.web.context.request.RequestContextListener
|
|
|
</listener-class>
|
|
|
</listener>
|
|
|
|
|
|
<!-- 4、使用Rest风格的URI,将页面普通的post请求转为指定的delete或者put请求 -->
|
|
|
<filter>
|
|
|
<filter-name>HiddenHttpMethodFilter</filter-name>
|
|
|
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
|
|
|
</filter>
|
|
|
<filter-mapping>
|
|
|
<filter-name>HiddenHttpMethodFilter</filter-name>
|
|
|
<url-pattern>/*</url-pattern>
|
|
|
</filter-mapping>
|
|
|
<filter>
|
|
|
<filter-name>HttpPutFormContentFilter</filter-name>
|
|
|
<filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class>
|
|
|
</filter>
|
|
|
<filter-mapping>
|
|
|
<filter-name>HttpPutFormContentFilter</filter-name>
|
|
|
<url-pattern>/*</url-pattern>
|
|
|
</filter-mapping>
|
|
|
|
|
|
<filter>
|
|
|
<filter-name>DruidWebStatFilter</filter-name>
|
|
|
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
|
|
|
<init-param>
|
|
|
<param-name>exclusions</param-name>
|
|
|
<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
|
|
|
</init-param>
|
|
|
</filter>
|
|
|
<filter-mapping>
|
|
|
<filter-name>DruidWebStatFilter</filter-name>
|
|
|
<url-pattern>/*</url-pattern>
|
|
|
</filter-mapping>
|
|
|
|
|
|
|
|
|
<welcome-file-list>
|
|
|
<welcome-file>index.jsp</welcome-file>
|
|
|
</welcome-file-list>
|
|
|
|
|
|
<!--去掉jsp页面的空白-->
|
|
|
<jsp-config>
|
|
|
<jsp-property-group>
|
|
|
<url-pattern>*.jsp</url-pattern>
|
|
|
<trim-directive-whitespaces>true</trim-directive-whitespaces>
|
|
|
</jsp-property-group>
|
|
|
</jsp-config>
|
|
|
|
|
|
|
|
|
</web-app>
|