13 Replies Latest reply on Jul 26, 2007 7:11 PM by Michael Yuan

    Very basic validation question

    Michael Courcy Newbie

      Hi,

      I want to try a very basic validation on an input text field which name is "value"

      This is my stateful bean

      ....
      
       public void sayHello()
       {
       facesMessages.add("hello #{hello.value}");
       }
      
      
      
       @Length(max=10)
       public String getValue()
       {
       return value;
       }
      
      ......
      


      And the jsf part
      <h:inputText id="value" required="true"
       value="#{hello.value}">
       <s:validate/>
      </h:inputText>
      
      <h:message for="value"/>
      


      If I don't fill the input, I have a "value is required" message, which is expected as I set required="true".

      But if the value is more than 10 characters long, I have no errors, however I put the annotation @Length(max=10).

      So what did I miss ?