6 Replies Latest reply on Jul 19, 2007 5:07 AM by gringalet

    touble with messages.properites

    gringalet

      i have configured the chinese charactor in the messages_zh.properties with resourceboundle 0.7.7, my eclipse version is 3.1. now the first time , i run my web seam application,and i get the "???" in my page, and then i refresh the page, it will become the chinese charactor which i want. what s trouble?

        • 1. Re: touble with messages.properites
          gringalet

          my pages.xml

          <!DOCTYPE pages PUBLIC
           "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
           "http://jboss.com/products/seam/pages-1.2.dtd">
          
          <pages>
          
           <page view-id="/home.jsp" >
           <navigation from-action="#{customerFinder.findCustomers}">
           <redirect view-id="/Customer/customer.jsp"/>
           </navigation>
           </page>
          
           <page view-id="/Customer/customer.jsp" >
           <navigation from-action="#{customerFinder.findCustomers}">
           <redirect view-id="/Customer/customer.jsp"/>
           </navigation>
           </page>
          
           <page view-id="/Customer/updateCustomer.jsp" />
           <page view-id="/Customer/detailCustomer.jsp" />
           <page view-id="/Customer/newCustomer.jsp" />
           <page view-id="/Contact/updateContact.jsp" />
           <page view-id="/Contact/detailContact.jsp" />
           <page view-id="/Contact/newContact.jsp" />
           <page view-id="/Contact/contact.jsp" />
           <page view-id="/Customer/*" login-required="true" />
           <page view-id="/Contact/*" login-required="true" />
           <exception class="org.jboss.seam.security.NotLoggedInException">
           <redirect view-id="/login.xhtml">
           <message>
           You must be logged in to perform this action
           </message>
           </redirect>
           </exception>
          
           <exception class="org.jboss.seam.security.AuthorizationException">
           <end-conversation />
           <redirect view-id="/security_error.xhtml">
           <message>
           You do not have the necessary security privileges to
           perform this action.
           </message>
           </redirect>
           </exception>
          
          </pages>
          


          my faces-config.xml:
          <!DOCTYPE pages PUBLIC
           "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
           "http://jboss.com/products/seam/pages-1.2.dtd">
          <faces-config>
           <managed-bean>
           <managed-bean-name>library2</managed-bean-name>
           <managed-bean-class>com.WCRM.departmenttree.Library</managed-bean-class>
           <managed-bean-scope>request</managed-bean-scope>
           </managed-bean>
          
          
           <navigation-rule>
          
           <navigation-case>
           <from-outcome>home</from-outcome>
           <to-view-id>/home.jsp</to-view-id>
           <redirect view-id="/home.jsp"/>
           </navigation-case>
           <navigation-case>
           <from-outcome>login</from-outcome>
           <to-view-id>/Login/login.jsp</to-view-id>
           <redirect view-id="/Login/login.jsp"/>
           </navigation-case>
           <navigation-case>
           <from-outcome>loggedIn</from-outcome>
           <to-view-id>/home.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>customer</from-outcome>
           <to-view-id>/Customer/customer.jsp</to-view-id>
           <redirect view-id="/Customer/customer.jsp"/>
           </navigation-case>
          
          
          
          
           <navigation-case>
           <from-outcome>department</from-outcome>
           <to-view-id>/dt.jsp</to-view-id>
           <redirect view-id="/dt.jsp"/>
           </navigation-case>
          
          
          
           <navigation-case>
           <from-outcome>newCustomer</from-outcome>
           <to-view-id>/Customer/newCustomer.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>detailCustomer</from-outcome>
           <to-view-id>/Customer/detailCustomer.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>updateCustomer</from-outcome>
           <to-view-id>/Customer/updateCustomer.jsp</to-view-id>
           </navigation-case>
          
          
           <navigation-case>
           <from-outcome>contact</from-outcome>
           <to-view-id>/Contact/contact.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>newContact</from-outcome>
           <to-view-id>/Contact/newContact.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>detailContact</from-outcome>
           <to-view-id>/Contact/detailContact.jsp</to-view-id>
           </navigation-case>
           <navigation-case>
           <from-outcome>updateContact</from-outcome>
           <to-view-id>/Contact/updateContact.jsp</to-view-id>
           </navigation-case>
          
           <navigation-case>
           <from-outcome>editUser</from-outcome>
           <to-view-id>/Login/editUser.jsp</to-view-id>
           </navigation-case>
           </navigation-rule>
           <!-- i18n -->
          
          
           <application>
           <locale-config>
           <default-locale>zh</default-locale>
           <supported-locale>en</supported-locale>
           <supported-locale>en_US</supported-locale>
           <supported-locale>en_AU</supported-locale>
           <supported-locale>de</supported-locale>
           <supported-locale>fr</supported-locale>
           </locale-config>
           </application>
          
           <!-- Same for all Seam applications -->
          
           <lifecycle>
           <phase-listener>
           org.jboss.seam.jsf.TransactionalSeamPhaseListener
           </phase-listener>
           </lifecycle>
          
          </faces-config>


          please give me a hand.

          • 2. Re: touble with messages.properites
            gringalet

            i have forgot these:
            my home.jsp

            <%@ page contentType="text/html;charset=utf-8"%>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html>
            <body>
            <f:view>
             <head>
             <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
             <style type="text/css" media="all">
             @import "s.css";
             </style>
             </head>
             <div>
             <h:form rendered="#{not identity.loggedIn}">
            
             <div class="loginwindow">
             <div class="title"><h:outputText value="user login" /></div>
             <div class="username"><h:outputText value="user name" /></div>
             <div class="ut"><h:inputText value="#{identity.username}" size="15" /></div>
             <div class="password"><h:outputText value="password" /></div>
             <div class="pt"><h:inputSecret value="#{identity.password}" size="17" /></div>
             <div class="btn"><h:commandLink value="#{messages.m_enter}" action="#{identity.login}" /></div>
             <div class="loginbk"><h:graphicImage value="img/loginwindow.gif" /></div>
             </div>
             </h:form>
             <h:form rendered="#{identity.loggedIn}" id="f">
             <div class="logout"><h:commandLink value="#{messages.m_out}" action="#{identity.logout}" /></div>
             </h:form>
             <h:form id="f2" rendered="#{identity.loggedIn}">
             <div class="upcomponent">
             <div class="upbk"><h:graphicImage value="img/upbk.gif" /></div>
             <div class="upwave"><h:graphicImage value="img/upwave.gif" /></div>
             <div class="computer"><h:graphicImage value="img/computer.gif" /></div>
             <div class="recentprj"><h:graphicImage value="img/recentprj.gif" /></div>
             </div>
             <div class="menu">
             <div class="bk">
             <h:graphicImage value="img/menu.gif" />
             </div>
             <div class="n1">
             <h:commandLink value="#{messages.m_customer}" action="#{customerFinder.findCustomers}"></h:commandLink>
             </div>
             <div class="n2">
             <h:graphicImage value="img/menu_seperate.gif" />
             </div>
             <div class="n3">
             <h:outputText value="" />
             </div>
             <div class="n4">
             <h:graphicImage value="img/menu_seperate.gif" />
             </div>
             </div>
             <div class="comingnews">
             <div class="comingnewsbk">
             <h:graphicImage value="img/comingnews.gif" />
             </div>
             <div class="title">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param1_title">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param1">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param1_submit">
             <h:outputText value="more"/>
             </div>
             <div class="param1bk">
             <h:graphicImage value="img/button.gif"/>
             </div>
             <div class="param2_title">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param2">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param2_submit">
             <h:outputText value="more"/>
             </div>
             <div class="param2bk">
             <h:graphicImage value="img/button.gif"/>
             </div>
             <div class="param3_title">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param3">
             <h:outputText value="comingnews"/>
             </div>
             <div class="param3_submit">
             <h:outputText value="more"/>
             </div>
             <div class="param3bk">
             <h:graphicImage value="img/button.gif"/>
             </div>
             </div>
            
             <div class="aboutus">
             <div class="imgbk">
             <h:graphicImage value="img/aboutus.gif" width="456" height="433" />
             </div>
             <div class="title"><strong>
             <h:outputText value="aboutus"/>
             </strong>
             </div>
             <div class="content"><strong>
             <h:outputText value="aboutus"/>
             </strong><br />
             </div>
             <div class="learnmore">
             <h:outputText value="more"/>
             </div>
             <div class="learnmorebk">
             <h:graphicImage value="img/button.gif"/>
             </div>
             <div class="img">
             <h:graphicImage value="img/ourimg.jpg" width="160px" />
             </div>
             </div>
             <div class="gradient">
             <div class="gradientimg">
             <h:graphicImage value="img/gradient.gif" width="780px" height="691px" />
             </div>
             </div>
             <div class="downwave">
             <div class="downwaveL">
             <h:graphicImage value="img/downwaveL.gif" />
             </div>
             <div class="downwaveM">
             <h:graphicImage
             value="img/downwaveM.gif" />
             </div>
             <div class="downwaveR">
             <h:graphicImage
             value="img/downwaveR.gif" />
             </div>
             </div>
             <div class="version">
             <h:outputText value=" webmaster@sap.com. " /> <br />
             <h:outputText value="SAPCRM.CN @ 2001-2005. " />
             </div>
             </h:form>
             </div>
            
            </f:view>
            </body>
            </html>
            


            my customer.jsp
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
            <f:view>
             <head>
             <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
             <title>
             <h:outputText value="#{messages.Home}" />
             </title>
             <style type="text/css" media="all">
             @import "customer.css";
             </style>
             </head>
             <body>
             <h:form rendered="true">
             <div class="customer" >
             <!---------three buttons on top-------------->
             <div class="customerbkup">
             <div class="bk">
             <h:graphicImage value="../img/customerdetail/bkup.gif" />
             </div>
             <div class="newcustomer">
             <h:commandLink action="#{customerEditor.createCustomer}"
             value="#{messages.m_new}" style="text-decoration:none" />
             </div >
             <div class="deletecustomer">
             <h:commandLink value="#{messages.m_delete}"
             action="#{customerEditor.deleteData}" style="text-decoration:none" />
             </div>
             <div class="editcustomer">
             <h:commandLink value="#{messages.m_edit}"
             action="#{customerSelector.select}" style="text-decoration:none"> </h:commandLink>
             </div>
             <div class="menu">
            
             <div class="n1">
             <h:commandLink value="#{messages.m_homepage}"
             action="home" style="text-decoration:none"> </h:commandLink>
             </div>
            
             <div class="n2">
             <h:commandLink value="#{messages.m_customer}"
             action="#{customerFinder.findCustomers}" style="text-decoration:none"> </h:commandLink>
             </div>
             <div class="n3">
             <h:outputText value="c" />
             </div>
             <div class="n4">
             <h:outputText value="d" />
             </div>
            
             </div>
             </div>
             <!----------cus----list--------------------->
             <div class="customerbkmid">
             <div class="page">
             <h:dataTable value="#{customerList}" var="project"
             rendered="#{customerList.rowCount>0}"
             styleClass="dvdtable"
             headerClass="dvdtablehead"
             rowClasses="results"
             columnClasses="dvdtablecol">
             <h:column>
             <f:facet name="header">
             <h:outputText value="id" />
             </f:facet>
             <h:outputText value="#{project.custId}" />
             </h:column>
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customername}" />
             </f:facet>
             <h:commandLink value="#{project.custName}"
             action="#{customerSelector.select1}" style="text-decoration:none"/>
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customercity}" />
             </f:facet>
             <h:outputText value="#{project.custCity}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value=" \u56FD \u5BB6" />
             </f:facet>
             <h:outputText value="#{project.custCountry}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customerdesc}" />
             </f:facet>
             <h:outputText value="#{project.custDesc}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customeremployeenum}" />
             </f:facet>
             <h:outputText value="#{project.custEmployeeNum}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customerfax}" />
             </f:facet>
             <h:outputText value="#{project.custFax}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customerphone}" />
             </f:facet>
             <h:outputText value="#{project.custPhone}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customerprovince}" />
             </f:facet>
             <h:outputText value="#{project.custProvince}" />
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customerlocation}" />
             </f:facet>
             <h:outputText value="#{project.custLocation}" />
             </h:column>
            
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{messages.m_customertype}" />
             </f:facet>
             <h:outputText value="#{project.custType}" />
             </h:column>
            
            
             <h:column>
             <h:selectBooleanCheckbox value="#{customerSelections[project]}" />
             </h:column>
             </h:dataTable>
            
             </div>
             <!-----------------prev and next buttons on bottom---------------------->
             <div class="customerbtn">
             <div class="nextpage">
             <h:commandLink action="#{customerFinder.nextPage}"
             rendered="#{!customerFinder.lastPage}" style="text-decoration:none">
             <h:outputText value="lastPage" />
             </h:commandLink>
             </div>
             <div class="prevpage">
             <h:commandLink action="#{customerFinder.prevPage}"
             rendered="#{!customerFinder.firstPage}" style="text-decoration:none">
             <h:outputText value="firstPage" />
             </h:commandLink>
             </div>
             <div class="customerbkbottom" >
             <h:graphicImage value="../img/customerdetail/bkbottom.gif" />
             </div>
             </div>
             </div>
             </div>
             </div>
             </h:form>
             </body>
            </f:view>
            </html>
            


            When i click the home.jsp and invoke " action='#{customerFinder.findCustomers}'", so it will be lead to customer.jsp. and this time i will see "???" in the customer.jsp,so i refresh the page by the button on the internet exploer,so everything is ok. tell me why?

            • 3. Re: touble with messages.properites
              atao

              In your faces-config.xml file:

               <application>
               <locale-config>
               <default-locale>zh</default-locale>
               <supported-locale>en</supported-locale>
               <supported-locale>en_US</supported-locale>
               <supported-locale>en_AU</supported-locale>
               <supported-locale>de</supported-locale>
               <supported-locale>fr</supported-locale>
               </locale-config>
               </application>
              


              zh is not declared as a supported-locale

              try after adding it.


              • 4. Re: touble with messages.properites
                gringalet

                it seems not work, i have done everything by what you said. man. so can you give me a advice?

                • 5. Re: touble with messages.properites
                  atao

                  Mmm, may be tell to JSF where to find the messages, add message-bundle tag:

                   <application>
                   <message-bundle>messages</message-bundle>
                   <locale-config>
                   <default-locale>en</default-locale>
                   <supported-locale>en</supported-locale>
                  [...]
                   </locale-config>
                   </application>
                  



                  • 6. Re: touble with messages.properites
                    gringalet

                    thank s. i have found that is very ......mmm,v:(
                    i lost the tag " <%@ page contentType="text/html;charset=utf-8"%>" in my customer.jsp. so internet exployer will be set with local to 'iso', so lots of "????" appear..
                    hi,ato. thank you very much.