2 Replies Latest reply on Mar 7, 2008 11:56 AM by nm-156

    Help with strange JSF <h:messages> behavior

    nm-156


      Local JBoss server 4.2

      Hi. I am displaying error messages via the <h:messages> tag, but this strange prefix shows up on the message when it's displayed:

      j_id_jsp_1488097600_1:formField3: Validation Error: Value is less than allowable minimum of '5'

      How can I suppress the j_id_jsp_1488097600_1:formField3: prefix, and what causes the extra verbage to be displayed? Do I have something specified incorrectly? The tag in my JSP looks like this:

      <h:inputText id="formField3" value="#{maintForm.formField3}">
      <f:validateLength minimum="5"/>
      </h:inputText>

      My faces.config has the following entry where I have application.properties in that package with my messages:


      <resource-bundle>
      <base-name>mypackagename.application</base-name>
      msgs
      </resource-bundle>


      Thanks.

        • 1. Re: Help with strange JSF <h:messages> behavior
          nm-156

          PS - resource-bundle tag is wrapped in an application tag. Thanks.

          • 2. Re: Help with strange JSF <h:messages> behavior
            nm-156

            A couple of things were causing the problem. I realized that the weird prefix seems to be caused by having my variable markers enclosed by single quotes '{0}' instead of double quotes "{0}". The second thing is that I needed to have the message-bundle entry in the faces config. Finally, I had to override the default validator message keys/values in my message file. So my faces.config now looks like:


            
             <application>
             <message-bundle>mypackagename.application</message-bundle>
             </application>
            
             <application>
             <resource-bundle>
             <base-name>mypackagename.application</base-name>
             <var>msgs</var>
             </resource-bundle>
             </application>
            
            


            And the message file looks like:

            
            javax.faces.component.UIInput.CONVERSION=Invalid entry, not the correct data type
            javax.faces.component.UIInput.REQUIRED=Value is required
            javax.faces.component.UISelectOne.INVALID=Value is not a valid option
            javax.faces.component.UISelectMany.INVALID=Value(s) are not a valid selection
            javax.faces.validator.NOT_IN_RANGE=Specified attribute is not between the expected values of "{0}" and "{1}"
            javax.faces.validator.DoubleRangeValidator.MAXIMUM=Value is greater than allowable maximum of "{0}"
            javax.faces.validator.DoubleRangeValidator.MINIMUM=Value is less than allowable minimum of "{0}"
            javax.faces.validator.DoubleRangeValidator.TYPE=Value is not of the correct type
            javax.faces.validator.LengthValidator.MAXIMUM=Value is greater than allowable maximum of "{0}"
            javax.faces.validator.LengthValidator.MINIMUM=Value is less than allowable minimum of "{0}"
            javax.faces.validator.LongRangeValidator.MAXIMUM=Value is greater than allowable maximum of "{0}"
            javax.faces.validator.LongRangeValidator.MINIMUM=Value is less than allowable minimum of "{0}"
            javax.faces.validator.LongRangeValidator.TYPE=Value is not of the correct type
            formField1Label=Form Field 1:
            formField2Label=Form Field 2:
            formField3Label=Form Field 3:
            formField4Label=Form Field 4: