class User { @NotEmpty @Size(max=50) String getName() { ... } @Email String getEmail() { ... } }Of course there are many many features like built-in constraints, custom constraint definition, constraint composition, groups for partial validation, internationalization and a metadata query API. Now is the time to play with it, Hibernate Validator 4 is aligned with the latest draft. Bean Validation will be part of Java EE 6 and has deep integration with Java Persitence 2 and Java Server Faces 2. But the spec is not tied to EE and can be used on any Java SE 5 environment. If you want to know more, go check what's new here and download Hibernate Validator 4 on sourceforge. Another somewhat outdated but still good resource is this list of blog entries. You can also find podcasts on the subject by the JavaPosse, Chariot TechCast and others. And please give us feedback in our forums and seriously start thinking constraint validation in your applications :)
-
Road to Final: Bean Validation JSR 303 and Hibernate Validator 4 (8 messages)
- Posted by: Emmanuel Bernard
- Posted on: July 22 2009 13:35 EDT
JSR 303 Bean Validation and Hibernate Validator 4 (the reference implementation) are now in their last draft before final. Bean Validation standardizes constraint declaration, definition, validation and metadata for the Java platform. Said otherwise, add an annotation to a property and hop it's validated.Threaded Messages (8)
- Re: Road to Final: Bean Validation JSR 303 and Hibernate Validator 4 by Mark N on July 23 2009 12:06 EDT
- Hopefully we'll see more UI frameworks picking up on this by Ronald Smith on July 24 2009 00:10 EDT
- Re: Hopefully we'll see more UI frameworks picking up on this by Emmanuel Bernard on July 24 2009 08:49 EDT
-
Re: Hopefully we'll see more UI frameworks picking up on this by Mark N on July 24 2009 07:56 EDT
-
Re: Hopefully we'll see more UI frameworks picking up on this by Emmanuel Bernard on July 25 2009 01:32 EDT
- Re: Hopefully we'll see more UI frameworks picking up on this by Emmanuel Bernard on July 25 2009 01:34 EDT
- Re: Hopefully we'll see more UI frameworks picking up on this by Mark N on July 27 2009 08:21 EDT
-
Re: Hopefully we'll see more UI frameworks picking up on this by Emmanuel Bernard on July 25 2009 01:32 EDT
-
Re: Hopefully we'll see more UI frameworks picking up on this by Mark N on July 24 2009 07:56 EDT
- Re: Hopefully we'll see more UI frameworks picking up on this by Emmanuel Bernard on July 24 2009 08:49 EDT
- struts 1 and jsr 303 integration with sbva by A A on April 18 2010 04:08 EDT
-
Re: Road to Final: Bean Validation JSR 303 and Hibernate Validator 4[ Go to top ]
- Posted by: Mark N
- Posted on: July 23 2009 12:06 EDT
- in response to Emmanuel Bernard
Excellent. Did some quick googlin'. I need to take good look at this. -
Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Ronald Smith
- Posted on: July 24 2009 00:10 EDT
- in response to Emmanuel Bernard
Looks interesting.. I was just looking for a validation framework and came across this. In particular I'm hoping more UI frameworks will be making use of this to generate client/server side validations. Here's a couple that look to be on the path: Wrote some more about this here -
Re: Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Emmanuel Bernard
- Posted on: July 24 2009 08:49 EDT
- in response to Ronald Smith
Looks interesting.. I was just looking for a validation framework and came across this. In particular I'm hoping more UI frameworks will be making use of this to generate client/server side validations.
Actually JSF 2.0 does integrates with Bean Validation out of the box, I am very happy about that. MyFaces is adding some additional features and RichFaces push your constraint validatiosn to the client using a JavaScript translator. That's an approach we've drafted but could not standardize in JSF 2.0 by lack of time. But you are right, any presentation framework can use Bean Validation and I hope to see integration with all the major ones sooner than later.
Here's a couple that look to be on the path:
Wrote some more about this here -
Re: Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Mark N
- Posted on: July 24 2009 19:56 EDT
- in response to Emmanuel Bernard
Looking for GWT, SWT/JFace (Eclipse RCP) and Swing integration.Looks interesting.. I was just looking for a validation framework and came across this. In particular I'm hoping more UI frameworks will be making use of this to generate client/server side validations.
Here's a couple that look to be on the path:
Wrote some more about this here
Actually JSF 2.0 does integrates with Bean Validation out of the box, I am very happy about that. MyFaces is adding some additional features and RichFaces push your constraint validatiosn to the client using a JavaScript translator. That's an approach we've drafted but could not standardize in JSF 2.0 by lack of time.
But you are right, any presentation framework can use Bean Validation and I hope to see integration with all the major ones sooner than later. -
Re: Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Emmanuel Bernard
- Posted on: July 25 2009 01:32 EDT
- in response to Mark N
Looking for GWT, SWT/JFace (Eclipse RCP) and Swing integration.
There is a project implementing a 303 / GWT, google for it. For the other two, I am not aware of someone implementing the link between Bean Validation's error report and the UI library error report but I can't imagine that being but trivial. FTR the method used by JSF is validator.validateValue which allows validation of a value before it reaches the domain model. In a classic UI framework, this method would be triggered when the field is losing focus (or when the nbr of key press event has settled and the data is considered entered. -
Re: Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Emmanuel Bernard
- Posted on: July 25 2009 01:34 EDT
- in response to Emmanuel Bernard
Any binding framework between the UI component and the data model would make a perfect integration point too actually.Looking for GWT, SWT/JFace (Eclipse RCP) and Swing integration.
There is a project implementing a 303 / GWT, google for it.
For the other two, I am not aware of someone implementing the link between Bean Validation's error report and the UI library error report but I can't imagine that being but trivial.
FTR the method used by JSF is validator.validateValue which allows validation of a value before it reaches the domain model. In a classic UI framework, this method would be triggered when the field is losing focus (or when the nbr of key press event has settled and the data is considered entered. -
Re: Hopefully we'll see more UI frameworks picking up on this[ Go to top ]
- Posted by: Mark N
- Posted on: July 27 2009 08:21 EDT
- in response to Emmanuel Bernard
There is a project implementing a 303 / GWT, google for it.
I should have said "Will be looking ... " -
struts 1 and jsr 303 integration with sbva[ Go to top ]
- Posted by: A A
- Posted on: April 18 2010 04:08 EDT
- in response to Emmanuel Bernard
I have written a struts 1 jsr-303 integration library available at
http://code.google.com/p/sbva/
to allow easy integration of jsr-303 with struts 1. If you try it please let me know what you think.