1 <!DOCTYPE web-app PUBLIC
2 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3 "http://java.sun.com/dtd/web-app_2_3.dtd" >
4
5 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xmlns="http://java.sun.com/xml/ns/javaee"
7 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
8 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
9
10 <display-name>test-ma</display-name>
11
12 <filter>
13 <filter-name>encodingFilter</filter-name>
14 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
15 <init-param>
16 <param-name>encoding</param-name>
17 <param-value>UTF-8</param-value>
18 </init-param>
19 <init-param>
20 <param-name>forceEncoding</param-name>
21 <param-value>true</param-value>
22 </init-param>
23 </filter>
24 <filter-mapping>
25 <filter-name>encodingFilter</filter-name>
26 <url-pattern>/*</url-pattern>
27 </filter-mapping>
28
29 <context-param>
30 <param-name>contextConfigLocation</param-name>
31 <param-value>classpath:/spring/application-context.xml</param-value>
32 </context-param>
33
34 <listener>
35 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
36 </listener>
37 </web-app>
详细搭建过程参考:https://www.cnblogs.com/xiuxingzhe/p/9250737.html