[jboss-user] [JBoss Seam] - Very basic validation question

michaelcourcy do-not-reply at jboss.com
Sat Jul 7 19:04:31 EDT 2007


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 ?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061648#4061648

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061648



More information about the jboss-user mailing list