0 Replies Latest reply on Mar 4, 2009 6:45 PM by peter irmstadt

    Need help with validators

    peter irmstadt Newbie


      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:


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

      and the related class

      public class TestBean implements Serializable
           private static final long serialVersionUID = 1L;
           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!