Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Process Validator in the backing bean vs in the jsf page

 
Laurent Wulser
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of custom validator class, is it possible to use it directly in the backing bean, like jsf2 annotation ? Or do we need imperatively to call the validator in the xhtml file with the f:validator ?

I would like to simplify the view. Otherwise, is it possible to create new validator annotation ?

Has someone any example of backing bean like that ?

Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little unclear on what you're hoping to accomplish. JSF validators are run before the backing bean "set" and action methods are invoked, and if validation fails, the "set" and action methods won't be invoked at all.

The virtue of JSF validators is, in fact, that they aren't Java code, but are specifications. Studies have determined that specifications are generally more efficient and safer to use than code - for the simple reason that specifications are inherently limited and therefore can be more rigorously checked and optimized with relatively little overhead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic