1 Reply Latest reply on Nov 10, 2009 10:57 PM by Laercio Tischer

    Problem in ISO-8859-1 search return UTF-8 result

    Laercio Tischer Newbie
      my SeamUserList.xhtml

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          template="layout/template.xhtml">

      ...

      <h:form id="seamUsersSearch" styleClass="edit">
              <rich:simpleTogglePanel label="QuickSearch" switchType="ajax">

                  <s:decorate template="layout/display.xhtml">
                      <ui:define name="label">Filter</ui:define>
                      <h:inputText id="name" value="#{seamUsersList.seamUsers.name}"/>
                  </s:decorate>

              </rich:simpleTogglePanel>

              <div class="actionButtons">
                  <h:commandButton id="search" value="Search" action="/admin/SeamUsersList.xhtml"/>
                  <s:button id="reset" value="Reset" includePageParams="false"/>
              </div>
      </h:form>


          <rich:panel>
              <f:facet name="header">SeamUsers Search Results</f:facet>
          <div class="results" id="seamUsersList">

          <h:outputText value="The seamUsers search returned no results."
                     rendered="#{empty seamUsersList.resultList}"/>

          <rich:dataTable id="seamUsersList"
                      var="_seamUsers"
                    value="#{seamUsersList.resultList}"
                 rendered="#{not empty seamUsersList.resultList}">

             
              <h:column>
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{seamUsersList}"/>
                          <ui:param name="propertyLabel" value="#{messages.SeamUsersName}"/>
                          <ui:param name="propertyPath" value="seamUsers.name"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_seamUsers.name}"/>
              </h:column>
         
          </rich:dataTable>

          </div>
          </rich:panel>
      ...




      my template.xhtml file

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <f:view contentType="text/html"
              xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:a="http://richfaces.org/a4j"
              xmlns:s="http://jboss.com/products/seam/taglib">
      <html>
      <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
          <title>OCB-RO</title>
          <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
          <a:loadStyle src="resource:///stylesheet/theme.xcss"/>
          <a:loadStyle src="/stylesheet/theme.css"/>
          <ui:insert name="head"/>
      </head>

      ...


      My SeamUsersList.page.xml fyle


      <?xml version="1.0" encoding="ISO-8859-1"?>
      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">

         <param name="firstResult" value="#{seamUsersList.firstResult}"/>
         <param name="sort" value="#{seamUsersList.orderColumn}"/>
         <param name="dir" value="#{seamUsersList.orderDirection}"/>

         <param name="from"/>
         <param name="name" value="#{seamUsersList.seamUsers.name}"/>
      </page>


      My SeamUserList.java file

      @Name("seamUsersList")
      public class SeamUsersList extends EntityQuery<SeamUsers> {

              private static final String EJBQL = "select seamUsers from SeamUsers seamUsers";

              private static final String[] RESTRICTIONS = {
                              "lower(seamUsers.name) like concat(lower(#{seamUsersList.seamUsers.name}),'%')", };

              private SeamUsers seamUsers = new SeamUsers();

              public SeamUsersList() {
                      setEjbql(EJBQL);
                      setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
                      setMaxResults(25);
              }

              public SeamUsers getSeamUsers() {
                      return seamUsers;
              }
      }


      But when I search any ISO-8859-1 word with punctuation character the return from the seach is the UTF-8 format.

      I have include in the components.xml the line <web:character-encoding-filter encoding="iso-8859-1" override-client="true" url-pattern="*.seam"/>
      but not resolve the problem.


      Any solution from the latin search work fine.