• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How the validation is done in JSF?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic