In JSF, what are Validators?
Answered
In JSF, what are Validators?
Best answer
JSF provides a set of standard classes and associated tags that page authors and application developers can use to validate a component’s data. The Validator classes in JSF are:
- BeanValidator – Registers a bean validator for the component.
- DoubleRangeValidator -Checks whether the local value of a component is within a certain range
- LengthValidator – Checks whether the length of a component’s local value is within a certain range. The value must be a java.lang.String.
- LongRangeValidator -Checks whether the local value of a component is within a certain range.
- RegexValidator -Checks whether the local value of a component is a match against a regular expression from the java.util.regex package.
- RequiredValidator -Ensures that the local value is not empty on an javax.faces.component.EditableValueHolder component.
All these validator classes implement the javax.faces.validator.Validator interface. Custom validators can be created by implementing this interface.