Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Primefaces 无法在.xhtml中设置字符编码UTF-8_Primefaces_Character Encoding_Websphere 8 - Fatal编程技术网

Primefaces 无法在.xhtml中设置字符编码UTF-8

Primefaces 无法在.xhtml中设置字符编码UTF-8,primefaces,character-encoding,websphere-8,Primefaces,Character Encoding,Websphere 8,我已将xhtml设置为UTF-8并应ServletRequest。但它似乎仍然无法检测到字符编码为UTF-8。我正在使用PrimeFaces3.5和WebSphere8 .xhtml <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> web.xml <filter> <description>Redirect unauthenticated se

我已将xhtml设置为UTF-8并应ServletRequest。但它似乎仍然无法检测到字符编码为UTF-8。我正在使用PrimeFaces3.5和WebSphere8

.xhtml

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
web.xml

    <filter>
        <description>Redirect unauthenticated session to login page.</description>
        <display-name>RedirectLogin</display-name>
        <filter-name>RedirectLogin</filter-name>
        <filter-class>com.belsize.servlet.filter.RedirectLogin</filter-class>
        <init-param>
            <param-name>login_page</param-name>
            <param-value>/faces/login.xhtml</param-value>
        </init-param>


    </filter>
    <filter-mapping>
        <filter-name>RedirectLogin</filter-name>
        <url-pattern>/RedirectLogin</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>RedirectLogin</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>

将未经验证的会话重定向到登录页面。
重定向登录
重定向登录
com.belsize.servlet.filter.RedirectLogin
登录页面
/faces/login.xhtml
重定向登录
/重定向登录
重定向登录
*.xhtml

我想我的环境是“肮脏的”。清理完我的项目后,重新部署,现在工作正常。

您尝试将
添加到.xhtml头中。@ronnk我在.xhtml文件的头中也有。但不起作用。您的意思是:您不能在xhtml文件中使用utf-8格式,或者最终用户不能提交utf-8格式?@RongNK我可以输入汉字,但当我单击按钮时,页面将刷新。页面刷新后,汉字变成了垃圾文本。你应该知道真正的问题,越南语很好用。
    <filter>
        <description>Redirect unauthenticated session to login page.</description>
        <display-name>RedirectLogin</display-name>
        <filter-name>RedirectLogin</filter-name>
        <filter-class>com.belsize.servlet.filter.RedirectLogin</filter-class>
        <init-param>
            <param-name>login_page</param-name>
            <param-value>/faces/login.xhtml</param-value>
        </init-param>


    </filter>
    <filter-mapping>
        <filter-name>RedirectLogin</filter-name>
        <url-pattern>/RedirectLogin</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>RedirectLogin</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>