1 Reply Latest reply on Jul 22, 2013 12:01 AM by Alfred Wong

    resource bundle doesn't work in entity bean validation

    Alfred Wong Newbie

      hi, i'm using jboss as7.1.0.final, seam 2.3.0.final and ejb 3.1, in my entity bean i did used resource bundle message as showed below:

       

      Method

          @Override

          @Column(name="PASTTIME", nullable=true)

          @Min(value=0, message= "#{messages['o.package.create.timespan.min.value']}")

          public Long getPastTimespan() {

              return this.pastTimespan;

          }

       

      Where suppose "o.package.create.timespan.min.value" key will be seek in the "omessages.properties" that i set in component.xml

       

      component.xml

          <core:resource-loader>

              <core:bundle-names>

                  <value>omessages</value>

              </core:bundle-names>

          </core:resource-loader>

       

      The same thing works last time when i was using jboss as4.2.2, seam 2.2.x and ejb 3.1 (e.g. http://docs.jboss.org/seam/latest-2.1/reference/en-US/html_single/)

       

      But now the message i see in webpage is "#{messages['o.package.create.timespan.min.value']}", which doesn't seems like look from resource bundle at all. I did saw some webpage mentioned about ValidationMessages.properties, but it is necessary to use that, all just some miss configuration on my side?

        • 1. Re: resource bundle doesn't work in entity bean validation
          Alfred Wong Newbie

          Alternative way to solve this issue is to use the ValidationMessages.properties as below:

           

              @Override

              @Column(name="PASTTIME",nullable=true)

              @Min(value=0,message="{o.package.create.timespan.min.value}")

              public Long getPastTimespan() {

                  return this.pastTimespan;

              }

           

          The ValidationMessages.properties must be available in the classpath.

          1 of 1 people found this helpful