开发者

Why does request.getCharacterEncoding() return null?

I have the following code in JSP

<%@page contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

and also in web.xml I have a filter

<filter>
    <filter-name>encodingFilter</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>

</filter>

<filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

But when I add request.getCharacterEncoding() to check the encoding, it returns null.开发者_JAVA技巧

Is there anyone who has experience about this problem? Thanks in advance.


Your JSP directive refers to responses.

Similarly, a quick Google for "chracterencoding filter spring" returned this forum thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜