10 Replies Latest reply on Aug 8, 2008 3:51 PM by chris.simons

    JSF Validation Woes; not finding messages_en.properties?

      I have run into a problem only it didn't use to do this...


      Now, when a validation error occurs, I see:


      createIssueForm:summaryDecorate:summary: Validation Error: Value is required.



      However, it used to only show the text Value is required, for example. I can't figure out what change we made that suddenly started reporting the full DOM ID for each validation message. It happens with all kinds of messages, not just required fields.


      I checked messages_en.properties and I'm puzzled because the properties look correct.


      <value>messages</value>


      I also have it within faces config as:


      <message-bundle>messages_en</message-bundle>


      I have also updated messages_en.properties with different values.  I see that the values have deployed but my Seam application seems to think the file doesn't exist?


      Any ideas?


      Thank you.


        • 1. Re: JSF Validation Woes; not finding messages_en.properties?
          dhinojosa

          We will need more information in order to help you.



          1. Are you using seam-gen or your folder structure.

          2. You don't need to map your message_bundle to faces-config.

          3. What does your web page that has this problem look like?

          4. Can we see your bean and/or validator?



          • 2. Re: JSF Validation Woes; not finding messages_en.properties?

            And please post the complete line in messages_en.properties for your Value is required message.

            • 3. Re: JSF Validation Woes; not finding messages_en.properties?
              admin.admin.email.tld

              You may want to examine the Seam registration distro example for any similarities.  I am seeing similar behavior, for example:


              form1:username: Validation Error: Value is required. 



              when I don't enter any values in the inputText fields and click register button, I get the above validation error.

              • 4. Re: JSF Validation Woes; not finding messages_en.properties?
                admin.admin.email.tld

                There is no messages.properties files in the registration folder.


                The booking example has one in C:\jboss-seam-2.0.1.GA\examples\booking\resources.


                So is messages.properties or messages_en.properties (or whichever locale you're using) in your resources folder?


                If yes, is the following line in it?


                javax.faces.component.UIInput.REQUIRED=value is required



                Perhaps it defaults to the text you're seeing or I'm seeing in the registration example when it's not overridden as above...


                Post the entire messages.properties file.

                • 5. Re: JSF Validation Woes; not finding messages_en.properties?

                  Thanks for the responses.  Please note that I have also made changes to messages_en.properties, ensured that the changes were in my deployed .war directory within /jboss/server, and still I receive the entire JSF stack and no noticeable change to the validation message.  The only thing I can think of at this point is that at one point we added an <f:load-bundle> in our Seam template for a properties file other then messages_en.properties.


                  Below is my entire /resources/messages_en.properties file.



                  up=\u2191
                  down=\u2193
                  left=\u2039
                  right=\u203A
                  
                  validator.assertFalse=validation failed
                  validator.assertTrue=validation failed
                  validator.future=must be a future date
                  validator.length=length must be between {min} and {max}
                  validator.max=must be less than or equal to {value}
                  validator.min=must be greater than or equal to {value}
                  validator.notNull=may not be null
                  validator.past=must be a past date
                  validator.pattern=must match "{regex}"
                  validator.range=must be between {min} and {max}
                  validator.size=size must be between {min} and {max}
                  validator.email=must be a well-formed email address
                  
                  org.jboss.seam.loginFailed=Login failed
                  #org.jboss.seam.loginSuccessful=Welcome, #0
                  org.jboss.seam.loginSuccessful=
                  
                  org.jboss.seam.TransactionFailed=Transaction failed
                  org.jboss.seam.NoConversation=The conversation ended, timed out or was processing another request
                  org.jboss.seam.IllegalNavigation=Illegal navigation
                  org.jboss.seam.ProcessEnded=Process #0 already ended
                  org.jboss.seam.ProcessNotFound=Process #0 not found
                  org.jboss.seam.TaskEnded=Task #0 already ended
                  org.jboss.seam.TaskNotFound=Task #0 not found
                  org.jboss.seam.NotLoggedIn=Please log in first
                  
                  javax.faces.component.UIInput.CONVERSION=value could not be converted to the expected type
                  javax.faces.component.UIInput.REQUIRED=value TEST is required
                  javax.faces.component.UIInput.UPDATE=an error occurred when processing your submitted information
                  javax.faces.component.UISelectOne.INVALID=value is not valid
                  javax.faces.component.UISelectMany.INVALID=value is not valid
                  
                  javax.faces.converter.BigDecimalConverter.DECIMAL=value must be a number
                  javax.faces.converter.BigDecimalConverter.DECIMAL_detail=value must be a signed decimal number consisting of zero or more digits, optionally followed by a decimal point and fraction, eg. {1}
                  javax.faces.converter.BigIntegerConverter.BIGINTEGER=value must be an integer
                  javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail=value must be a signed integer number consisting of zero or more digits
                  javax.faces.converter.BooleanConverter.BOOLEAN=value must be true or false
                  javax.faces.converter.BooleanConverter.BOOLEAN_detail=value must be true or false (any value other than true will evaluate to false)
                  javax.faces.converter.ByteConverter.BYTE=value must be a number between 0 and 255
                  javax.faces.converter.ByteConverter.BYTE_detail=value must be a number between 0 and 255
                  javax.faces.converter.CharacterConverter.CHARACTER=value must be a character
                  javax.faces.converter.CharacterConverter.CHARACTER_detail=value must be a valid ASCII character
                  javax.faces.converter.DateTimeConverter.DATE=value must be a date
                  javax.faces.converter.DateTimeConverter.DATE_detail=value must be a date,  eg. {1}
                  javax.faces.converter.DateTimeConverter.TIME=value must be a time
                  javax.faces.converter.DateTimeConverter.TIME_detail=value must be a time,  eg. {1}
                  javax.faces.converter.DateTimeConverter.DATETIME=value must be a date and time
                  javax.faces.converter.DateTimeConverter.DATETIME_detail=value must be a date and time,  eg. {1}
                  javax.faces.converter.DateTimeConverter.PATTERN_TYPE=a pattern or type attribute must be specified to convert the value
                  javax.faces.converter.DoubleConverter.DOUBLE=value must be a number
                  javax.faces.converter.DoubleConverter.DOUBLE_detail=value must be a number between 4.9E-324 and 1.7976931348623157E308
                  javax.faces.converter.EnumConverter.ENUM=value must be convertible to an enum
                  javax.faces.converter.EnumConverter.ENUM_detail=value must be convertible to an enum or from the enum that contains the constant {1}
                  javax.faces.converter.EnumConverter.ENUM_NO_CLASS=value must be convertible to an enum or from the enum, but no enum class provided
                  javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail=value must be convertible to an enum or from the enum, but no enum class provided
                  javax.faces.converter.FloatConverter.FLOAT=value must be a number
                  javax.faces.converter.FloatConverter.FLOAT_detail=value must be a number between 1.4E-45 and 3.4028235E38
                  javax.faces.converter.IntegerConverter.INTEGER=value must be an integer
                  javax.faces.converter.IntegerConverter.INTEGER_detail=value must be an integer number between -2147483648 and 2147483647
                  javax.faces.converter.LongConverter.LONG=value must be an integer
                  javax.faces.converter.LongConverter.LONG_detail=must be an integer number between -9223372036854775808 and 9223372036854775807
                  javax.faces.converter.NumberConverter.CURRENCY=value must be a currency amount
                  javax.faces.converter.NumberConverter.CURRENCY_detail=value must be a currency amount, eg. {1}
                  javax.faces.converter.NumberConverter.PERCENT=value must be a percentage amount
                  javax.faces.converter.NumberConverter.PERCENT_detail=value must be a percentage amount, eg. {1}
                  javax.faces.converter.NumberConverter.NUMBER=value must be a number
                  javax.faces.converter.NumberConverter.NUMBER_detail=value must be a number
                  javax.faces.converter.NumberConverter.PATTERN=value must be a number
                  javax.faces.converter.NumberConverter.PATTERN_detail=value must be a number
                  javax.faces.converter.ShortConverter.SHORT=value must be an integer
                  javax.faces.converter.ShortConverter.SHORT_detail=value must be an integer number between -32768 and 32767
                  
                  javax.faces.validator.DoubleRangeValidator.MAXIMUM=value must be less than or equal to {0}
                  javax.faces.validator.DoubleRangeValidator.MINIMUM=value must be greater than or equal to {0}
                  javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE=value must be between {0} and {1}
                  javax.faces.validator.DoubleRangeValidator.TYPE=value is not of the correct type
                  javax.faces.validator.LengthValidator.MAXIMUM=value is must be shorter than or equal to {0} characters
                  javax.faces.validator.LengthValidator.MINIMUM=value is must be longer than or equal to {0} characters
                  javax.faces.validator.LongRangeValidator.MAXIMUM=value must be less than or equal to {0}
                  javax.faces.validator.LongRangeValidator.MINIMUM=value must be greater than or equal to {0}
                  javax.faces.validator.LongRangeValidator.NOT_IN_RANGE=value must be between {0} and {1}
                  javax.faces.validator.LongRangeValidator.TYPE=value is not of the correct type
                  
                  javax.faces.validator.NOT_IN_RANGE=value must be between {0} and {1}
                  javax.faces.converter.STRING=value could not be converted to a string'


                  • 6. Re: JSF Validation Woes; not finding messages_en.properties?
                    pmuir

                    Show your faces-config.xml

                    • 7. Re: JSF Validation Woes; not finding messages_en.properties?

                      Pete,


                      Here is our faces-config.  I've tried different combinations, including removing the messages message bundle all together.  Do you think that calling ...


                      <f:loadBundle basename="global_messages" var="globalMsg"/>


                      ... in our default template may have something to do with this problem?  Perhaps the f:loadBundle is causing a conflict?  Keep in mind that "global_messages" is just another properties file with some custom (non-validation) messages.  Thanks.


                      <?xml version='1.0' encoding='UTF-8'?>
                      <!DOCTYPE faces-config PUBLIC
                                "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                                "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
                      
                      <faces-config>
                          <application>
                               <message-bundle>messages</message-bundle>
                               <message-bundle>da_messages</message-bundle>
                               <message-bundle>form_descriptors</message-bundle>
                               <message-bundle>global_messages</message-bundle>
                               <message-bundle>pm_messages</message-bundle>
                                <locale-config>
                                     <default-locale>en</default-locale>
                                </locale-config>
                          </application>
                      <!-- 
                          <lifecycle>
                              <phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
                          </lifecycle>
                       -->
                       
                            <navigation-rule> 
                              <from-view-id>/pm/pds/retirement/retirementDetailsStep1.xhtml</from-view-id> 
                               <navigation-case> 
                                 <from-outcome>next</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/retirementDetailsStep2.xhtml</to-view-id> 
                               </navigation-case> 
                           </navigation-rule>
                           <navigation-rule> 
                              <from-view-id>/pm/pds/retirement/retirementDetailsStep2.xhtml</from-view-id> 
                               <navigation-case> 
                                 <from-outcome>previous</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/retirementDetailsStep1.xhtml</to-view-id> 
                               </navigation-case> 
                               <navigation-case> 
                                 <from-outcome>next</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/retirementDetailsStep3.xhtml</to-view-id> 
                               </navigation-case> 
                            </navigation-rule>
                            <navigation-rule> 
                              <from-view-id>/pm/pds/retirement/retirementDetailsStep3.xhtml</from-view-id> 
                               <navigation-case> 
                                 <from-outcome>previous</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/retirementDetailsStep2.xhtml</to-view-id> 
                               </navigation-case>
                               <navigation-case> 
                                 <from-outcome>next</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/confirmRetirement.xhtml</to-view-id> 
                               </navigation-case>  
                            </navigation-rule>
                            <navigation-rule> 
                              <from-view-id>/pm/pds/retirement/confirmRetirement.xhtml</from-view-id> 
                               <navigation-case> 
                                 <from-outcome>previous</from-outcome> 
                                 <to-view-id>/pm/pds/retirement/retirementDetailsStep3.xhtml</to-view-id> 
                               </navigation-case>  
                            </navigation-rule>   
                      
                      </faces-config>



                      • 8. Re: JSF Validation Woes; not finding messages_en.properties?
                        pmuir

                        Don't override the message bundle in faces-config.xml (as then Seam doesn't use the Seam message bundle and interpolation for built in JSF messages).


                        I would just use Seam's resource handling throughout, its better :-)

                        • 9. Re: JSF Validation Woes; not finding messages_en.properties?

                          Thanks, Pete.  I will remove the message bundle and let you know the results.  I suppose our f-load bundle won't work after I do this, though...we'll have to see.


                          Thanks for the quick replies.

                          • 10. Re: JSF Validation Woes; not finding messages_en.properties?

                            Pete,


                            That worked.  And it's looking for the file under /resources/WEB-INF/classes, is that right? 


                            Now I need to research using Seam messages the proper way.


                            Thanks!