aspose file tools*
The moose likes JSF and the fly likes How the validation is done in JSF? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How the validation is done in JSF?" Watch "How the validation is done in JSF?" New topic
Author

How the validation is done in JSF?

Adi Wanik
Greenhorn

Joined: Feb 15, 2011
Posts: 7
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

Joined: Jan 10, 2002
Posts: 61064
    
  66

"Adi dont know", please check your private messages for an important administrative matter. Thanks.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Adi Wanik
Greenhorn

Joined: Feb 15, 2011
Posts: 7
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

Joined: Jun 25, 2001
Posts: 16019
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How the validation is done in JSF?