JSF Bean Validation Tutorial

JSF Bean Validation Tutorial


Posted in : Java Posted on : June 18, 2012 at 12:13 PM Comments : [ 0 ]

In this tutorial you will learn about the Bean Validation (JavaBeans Validation).

JSF Bean Validation Tutorial

In this tutorial you will learn about the Bean Validation (JavaBeans Validation).

Bean Validation (JavaBeans validation) is a model of validation that is newly introduced in Java EE 6 platform. Support of Bean validation is given by using the annotation constraint by putting it with the field, method, or class of a JavaBeans component (wherever required). Constraints that support the Bean Validation can be a custom or built in constraint. Custom constraint is called user-defined constraint and the constraint available to use is called built in constraint. Some of the built in constraint are available in the javax.validation.constraints package. JSF 2.x.x provides the built in integration with JSR 303 constraints.

Some of the annotation constraints are given into the table :

Annotation Constraints Description
@AssertFalse Validate to false value for the field or property.
@AssertTrue Validate to true value for the field or property.
@DecimalMax Validate to the decimal value for the field or
property less than or equals to the defined
number in the value element.
@DecimalMin Validate to the decimal value for the field or
property greater than or equals to the defined
number in the value element.
@Digits Validate to the number for the field or property
within the specified range.
@Future Validate to the date value in future for the field
or property.
@Max Validate to the integer number for the field or
property lower than or equal to the defined
number in the value element.
@Min Validate to the integer number for the field or
property greater than or equal to the defined
number in the value element.
@NotNull Validate to the field or property must not be null
@Null Validate to the field or property must be null.
@Past Validate to the date value in the past for the field
or property.
@Pattern Validate the field or property to match the regular
expression with the defined regexp element.
@Size Validate to the field or property for the specified
size or boundries.

Click Here to See the example of JSF validateBean tag.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics