org.springframework.web.filter.CharacterEncodingFilter 配置
web.xml文件
CharacterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter
init-param>
encoding
GB2312
forceEncoding
true
SetCharacterEncoding
*.jsp
public class CharacterEncodingFilter
extends OncePerRequestFilter
Servlet 2.3/2.4 Filter that allows one to specify a character encoding for requests. This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form.
This filter can either apply its encoding if the request does not already specify an encoding, or enforce this filter's encoding in any case ("forceEncoding"="true"). In the latter case, the encoding will also be applied as default response encoding on Servlet 2.4+ containers (although this will usually be overridden by a full content type set in the view).
CharacterEncodingFilter by Spring class
最新推荐文章于 2025-08-15 12:37:27 发布