Hi,
My environment:
JSF 2.0.3
PrimeFaces 2.2.RC2
Tomcat 6
JDK 1.6
I am looking to use hibernate bean validator for my model beans is this currently supported ? - I am looking for something similar to richfaces beanValidator functionality. I thought that JSF 2 supported JSR 303 and I am surprised not to see any examples on the showcase - can you confirm if this is supported or not ?
Thanks,
T.
JSF 2.0.3 PrimFaces 2.2 and JSR 303
-
- Posts: 25
- Joined: 28 Jan 2011, 15:18
hi tkelly
jsr303 works fine for me with primefaces. See my maven dependencies below
Most important for JSR-303 is the hibernate-validator dependency. Once you have it in your classpath jsf2 does the rest automatically. Really nice.
cheers
marc
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3-b03</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3-b03</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>2.2.RC2</version>
</dependency>
jsr303 works fine for me with primefaces. See my maven dependencies below
Most important for JSR-303 is the hibernate-validator dependency. Once you have it in your classpath jsf2 does the rest automatically. Really nice.
cheers
marc
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3-b03</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3-b03</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>2.2.RC2</version>
</dependency>
Hi Marc,
Good to know that you have it set-up and working for you.
I have similar jars as yourself but was trying to get validation working with the p:wizard tag. Once I know it's possible i will get a spike project set-up and post some code.
Thanks for your response.
T.
Good to know that you have it set-up and working for you.
I have similar jars as yourself but was trying to get validation working with the p:wizard tag. Once I know it's possible i will get a spike project set-up and post some code.
Thanks for your response.
T.
Wow! You guys are genius.
I saw this "Client Side Validation" in RichFaces 4 http://in.relation.to/Bloggers/RichFace ... Validation. If you're too lazy to follow the link I gave and if you trust me in corectly comprehending that article, this is its idea: the bean validations on the server side can be copied to the client side if possible. For example, this bean validation can be brought to the client side like this . I haven't tried it yet but I think the client side validations will be triggered when the form is submitted. In case we need to trigger the validation way before the form is submitted, we can write . It's nice, isn't it?
Do we have anything similar or better in PrimeFaces?
I saw this "Client Side Validation" in RichFaces 4 http://in.relation.to/Bloggers/RichFace ... Validation. If you're too lazy to follow the link I gave and if you trust me in corectly comprehending that article, this is its idea: the bean validations on the server side can be copied to the client side if possible. For example, this bean validation
Code: Select all
@Size(min=3, max=12) private String name;
Code: Select all
<h:inputText value="#{userBean.name}">
<rich:validator/>
</h:inputText>
Code: Select all
<rich:validator event="keyup"/>
Do we have anything similar or better in PrimeFaces?
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 68 guests