释放双眼,带上耳机,听听看~!
************ ————吾亦无他,唯手熟尔,谦卑若愚,好学若饥————-************
配置一道拦截器即可解决乱码
配置方式如下:
在web.xml中:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 1 <!--过滤器处理乱码-->
2 <filter>
3 <filter-name>CharacterEncoding</filter-name>
4 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
5 <!--请求-->
6 <init-param>
7 <param-name>encoding</param-name>
8 <param-value>utf-8</param-value>
9 </init-param>
10 <!--响应-->
11 <init-param>
12 <param-name>forceEncoding</param-name>
13 <param-value>true</param-value>
14 </init-param>
15 </filter>
16
17 <filter-mapping>
18 <filter-name>CharacterEncoding</filter-name>
19 <url-pattern>/*</url-pattern>
20 </filter-mapping>
21