0 Replies Latest reply on Mar 4, 2009 6:45 PM by germandev.net-seam.wje-online.de

    Need help with validators

    germandev.net-seam.wje-online.de

      Hi!


      I just got started with Seam and am trying to get started using the book JBoss Seam Simplicity and Power Beyond Java EE that has just arrived.


      I created a simple example for playing around with validators. I'm not using AJAX (yet).


      There must be something I didn't understand or forgot to do:


      XHTML:


              <h:form>
              <s:validateAll>
              <h:inputText id="txtInput" value="#{test.testvalue}" required="true"/>
              <h:message for="txtInput"/>
              <br/>
              <h:commandButton action="#{testaction.testAction}" value="Submit" />
              </s:validateAll>
              </h:form>



      and the related class



      @Name("test")
      public class TestBean implements Serializable
      {
           private static final long serialVersionUID = 1L;
           @Length(min=2,max=4,message="invalid!")
           private String testvalue;
           public String getTestvalue() {return testvalue;}
           public void setTestvalue(String testvalue){this.testvalue=testvalue;}
      
      }



      The action class isn't important here, is it?


      No matter what I input in the text field it is saved.
      What should I change so that the error message is shown, when the length of the input is not between 2 and 4 chars?


      Thank you in advance!