I have a very simple application,there is an inputtext in my index page and a button to go to page2.xhtml.
<h:body>
<h:form>
<h:inputText value="#{mainBean.testValue}"/>
<p:commandButton update="myoutput" value="ajax call" ajax="false"/>
<p:separator />
<h:commandButton action="#{mainBean.gotoPageTwo}" value="goto Page2"/>
<br/>
<h:outputText value="#{mainBean.testValue}" id="myoutput"/>
</h:form>
</h:body>
</html>
I tested this application with PrimeFaces 2.2.1 and there was no problem. but after submit each of the above button, my UTF-8 characters will destroy. I tested filter but it don't work. Is it a bug in PrimeFaces 3.x? Can any body solve this problem?
The
web.xml
example of the answer you found at PrimeFaces forum is incomplete. The<filter-mapping>
is missing. Without that, the filter won't even run at all. Add it accordinglyWhen you're already on Servlet 3.0 (Tomcat 7, Glassfish 3, etc), an alternative is to use just the
@WebFilter
annotation on the class. Don't forget to remove the filter entry fromweb.xml
.For a background explanation of the cause of this character encoding problem during PrimeFaces 2.x-3.x upgrade, see also Unicode input retrieved via PrimeFaces input components become corrupted