• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How the validation is done in JSF?

 
Adi Wanik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys..
can anybody explain me how the validation is achieved in JSF??

i am having one input field of time management, and when i enter invalid junk characters, then i get errors..And i want to know where exactly the validation takes place??

please guide me.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Adi dont know", please check your private messages for an important administrative matter. Thanks.
 
Adi Wanik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys..
can anybody explain me how the validation is achieved in JSF??

i am having one input field of time management, and when i enter invalid junk characters, then i get errors..And i want to know where exactly the validation takes place??

please guide me
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for fixing your display name, Adi. Here's some info that may help.

Validation is a standard phase in the JSF request/response lifecycle. At Validation time, the data which was in the submitted input controls is presented to the validators, which make up part of the Controller framework of JSF's MVC atchitecture.

Validators come in 2 varieties: built-in and user-defined. The built-in ones are supported by their own JSF tags, such as <f:validateLongRange>. User-defined validators are normally defined to be used with the general-purpose validation tag.

In either event, the core functionality is a validate() method that returns void when the data is OK. When the function determines that the data is not valid, it throws a ValidationException and the error message set as the Exception message text.

JSF's master Controller (FacesServlet) will then catch the exception, push the error message into the request's FacesContext messages object, and then proceed. Since it has detected a validation error, it will skip the phases of the JSF lifecycle that can only be done if the data is valid, such as the Update Data and fire Action phases.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic