Filtering PrimeFaces 3.3 <p: datatable> with UTF8

I have a PrimeFaces 3.3 / JSF application that I am deploying to JBoss AS 7.1. To display my data, I use p: dataTable with some filtering headers. Here's the code (after narrowing the sources):

<p:outputPanel id="custDataTable">            
        <p:dataTable var="item" value="#{customerController.items}" rowKey="#{item.id}"
                        selection="#{customerController.current}" selectionMode="single" id="customersTable">
            <p:column headerText="Surname" sortBy="#{item.surname}" filterBy="#{item.surname}" id="surname">  
                #{item.surname}
            </p:column>  
            <p:column headerText="Age" sortBy="#{item.age}" filterBy="#{item.age}" id="age" styleClass="age">
                #{item.age}
            </p:column>
            <p:column headerText="&nbsp;">
                <p:spacer width="20" height="0" />
                <p:commandButton update=":custForm" ajax="false" action="#{customerController.prepareEdit}" value="edit">
                    <f:setPropertyActionListener value="#{item}" target="#{customerController.current}" />
                </p:commandButton>
            </p:column>
        </p:dataTable>  
</p:outputPanel>

The PrimeFaces p: dataTable filter on the Ascending column always works, but strange behavior occurs in the Surname column. If the bean instance variable elements are elements with an ASCII data in the surname, then the filtering works. But when UTF8 data is present, filtering only works partially:

[1] UTF8 , ( ).

[2] bean current null. :

selection="#{customerController.current}"

, . CustomerController:: prepareEdit, p: commandButton null. , ( UTF8). , UTF8, .

, :

public class CharacterEncodingFilter implements Filter {

    @Override
    public void doFilter(ServletRequest req,
                             ServletResponse resp,
                             FilterChain chain)
             throws IOException, ServletException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        chain.doFilter(req, resp);
    }

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app ...
...
  <filter>                                                                                                                                           
      <filter-name>Character Encoding Filter</filter-name>                                                                                           
      <filter-class>mp.util.CharacterEncodingFilter</filter-class>                                                                                   
  </filter>      
</web-app>

.

+5
1

, ​​ UTF-8. -, URL-, . . /* FacesServlet.

@WebFilter("/*")
public class CharacterEncodingFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        chain.doFilter(request, response);
    }

    // ...
}

. :

+7

All Articles