<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>
如果没有
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
是没作用的
<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>
如果没有
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
是没作用的
本文介绍如何在Spring MVC中正确配置CharacterEncodingFilter来确保客户端请求的数据使用UTF-8编码,包括必要的初始化参数forceEncoding及其值true的重要性。
735

被折叠的 条评论
为什么被折叠?



