I'm trying to integrate bean validation using hibernate validator to my web application :
- Hibernate-spring-jsf2-primefaces3 on tomcat 7
I added following jar files : hibernate-validator.jar and validation-api.jar to my classpath in Netbeans.
In the pojo class, I added annotation for Size :
@Size(min=4, message="Min 4 chars!")
private String name;
In the .xhtml page I wrote :
<p:inputText title="name" id="name" value="#{myBean.user.name}"></p:inputText>
<p:message for="name" />
after running my application and typing less than 4 chars in the name field I see no message and the processing continue and save data to database. In the log output I saw :
14 juin 2012 14:55:03 org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate shouldAddEnclosingValidator
ATTENTION: Bean validation is not available on the classpath, thus the BeanValidator will not be added for the component org.primefaces.component.inputtext.InputText@1f3fd22
14 juin 2012 14:55:04 javax.faces.component._ExternalSpecifications isBeanValidationAvailable
INFO: MyFaces Bean Validation support disabled
I want to know if there is any config I have to set, or any jar file I have to add.