SSM-SpringMVC-19:SpringMVC中请求和响应的乱码解决

 ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥-------------

配置一道拦截器即可解决乱码

配置方式如下:

在web.xml中:

  <!--过滤器处理乱码-->
<filter>
<filter-name>CharacterEncoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<!--请求-->
<init-param>
<param-name>encoding</param-name>
<param-value>utf-</param-value>
</init-param>
<!--响应-->
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter> <filter-mapping>
<filter-name>CharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
上一篇:xenomai内核解析---内核对象注册表—xnregistry(重要组件)


下一篇:Tomcat 优化