4 Replies Latest reply on Nov 17, 2008 4:01 AM by arissonleal

    problem with error message

    arissonleal

      Hi,


      I got the jboss-seam-2.1.0.SP1 and create my war project using seam-gen.


      When i put a input like this:


      <h:inputText id="name" value="#{mybean.name}" required="true" label="Name" />
      



      My erro message don't display: Name: value required


      Just display: value required


      In others versions works fine :)


      What could be wrong ?

        • 1. Re: problem with error message
          valatharv
          Not sure about other versions, try adding requiredMessage="any text you want", it will display next to text field...

          <h:inputText id="name" value="#{mybean.name}"
             required="true"
             requiredMessage="Name: value required"
             label="Name" />
          • 2. Re: problem with error message
            arissonleal

            This problem occur just in WAR projects.


            I tested with EAR and works fine.


            Anybody knows how can i resolve this problem ?

            • 3. Re: problem with error message

              Try to add the following line to your message.properties.


              javax.faces.component.UIInput.REQUIRED={0} is a required field.



              I usually override these messages in customMessages.properties file and add an entry for message-bundle in faces-config.xml


              faces-config.xml



                   <application>
                        <message-bundle>customMessages</message-bundle>
                              <!-- Rest of your stuff -->
                   </application>




              customMessages.properties file


              javax.faces.component.UIInput.REQUIRED={0} is a required field.




              Make sure customMessages.properties is in your classpath.

              • 4. Re: problem with error message
                arissonleal

                I forgot this simple detail {0}


                thanks :)