As an alternative to creating a separate validator class, you can simply implement custom validation in a backing bean method, as long as the method adheres to the same argument signature as the Validator interface's validate method. For instance, you might write the following method:
as you have required = true for your InputText that means you are using jsf inbuilt validation so it first validating through that only as it is failing the condition of required = true it is throwing validationException and aborting the next validations for that component.
if you provide some text in that field then your custom validator will get called.
Joined: Jun 03, 2009
Thanks for your reply , so is there any way to show custom message for no value (NULL) in a text field ?
It seems validators are not triggered if the value is empty. So checking for emptiness with validators is pointless, they will never be reached.
Am new to jsf, am doing custom validation, i was unable to do validations for 5 fields at a time,using validator interface.
Can any one explain me with an example how to validate 5fields in a jsf page using validator interface.