Process Validator in the backing bean vs in the jsf page
posted 4 years ago
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 ?
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'tJava 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.
An IDE is no substitute for an Intelligent Developer.