Wednesday Jun 06

Links

Books

User Menu

AddThis

AddThis Social Bookmark Button

Bean Validation - JSR 303

PDF Print E-mail
Monday, 26 September 2011 08:55
AddThis Social Bookmark Button

JSF 2 Bean Validation (JSR 303)

Bean Validation with JSR 303

A common issue when receiving data either electronically or from user input is verifying the integrity of the data. This work is repetitive and becomes even more complicated when different sets of validation rules need to be applied to the same set of data based on locale. Error messages may also vary by locale. The JSR 303 addresses some of these issues to speed development and maintenance of validation rules.

V

alidating data is a common task that occurs throughout an application, from the presentation layer to the persistence layer. Often the same validation logic is implemented in each layer, proving to be time consuming and errorprone. To avoid duplication of these validations in each layer, developers often bundle validation logic directly into the domain model , cluttering domain classes with validation code that is, in fact, metadata about the class itself.

The JSR 303 defines a metadata model and API for JavaBean validation . The default metadata source is annotations , with the ability to override and extend the meta-data through the use of XML validation descriptors.

The validation API developed by this JSR is not intended for use in any one tier or programming model. It is specifically not tied to either the web tier or the persistence tier , and is available for both server-side application programming, as well as rich client Swing application developers. This API is seen as a general extension to the JavaBeans object model, and as such is expected to be used as a core component in other specifications. Ease of use and flexibility have influenced the design of this specification.

Source :  jsr 303 specifications

You can download the specifications on the JCP site

JSR 303 implementations

Provider Name Version Download
Hibernate hibernate-validator (API)

4.0.2.GA

Donwload binary

Code Google GWT-Vadliation

1.1.0-R88

Download binary
Code Google Wicket-jsr303-Validators

Download binary

What is not

  • JSR 303 is not designed for Cross validation
Tags: java , bean , server , faces , validation

Add comment


Security code
Refresh