5 Replies Latest reply on Oct 24, 2007 5:30 PM by pmuir

    Hibernate validator and more error messages

    martin.krajci

      Hi conference,

      I'm using hibernate validators in my Seam application:

      xhtml:

      <s:decorate id="numberOfNightsDecoration" template="validate.xhtml">
       <h:outputLabel value="#{msg.number_of_nights}" for="#{msg.number_of_nights}"/>
       <h:inputText value="#{reservation.numberOfNights}" id="#{msg.number_of_nights}" required="true">
       <a:support event="onblur" ajaxSingle="true" reRender="numberOfNightsDecoration">
       <s:conversationId/>
       </a:support>
       </h:inputText>
       </s:decorate>



      java:

      @Min(value=1, message="#{messages['validator.min']}")
       @Max(value=100, message="#{messages['validator.max']}")
       @Column(name = "number_of_nights", unique = false, nullable = false, insertable = true, updatable = true)
       public int getNumberOfNights() {
       return numberOfNights;
       }


      and when I submit the UI form I with value 0 for numberOfNights I get more the same error messages in h:messages component.

      <f:subview rendered="#{! empty facesContext.maximumSeverity}">
       <div class="errors">
       <div><h:messages/></div>
       </div>
       </f:subview>


      something like this:

      # Value is too small
      # Value is too small
      # Value is too small
      .

      Do you have any idea why the error message is dispalyed in UI more times?

      Thanx for any help.

      Martin