A Validator
implementation is a class that can perform validation (correctness
checks) on a javax.faces.component.EditableValueHolder. Zero
or more Validators can be associated with each javax.faces.component.EditableValueHolder in the view, and are
called during the Process Validations phase of the request
processing lifecycle.
Individual Validators should examine the value and
component that they are passed, and throw a ValidatorException
containing a javax.faces.application.FacesMessage, documenting
any failures to conform to the required rules.
For maximum generality, Validator instances may be
configurable based on properties of the Validator implementation
class. For example, a range check Validator might support
configuration of the minimum and maximum values to be used.
Validator implementations must have a zero-arguments
public constructor. In addition, if the Validator class
wishes to have configuration property values saved and restored with
the view, the implementation must also implement javax.faces.component.StateHolder.
If the class implementing
Validator has a javax.faces.application.ResourceDependency annotation, the action
described in ResourceDependency must be taken when
javax.faces.component.EditableValueHolder#addValidator is
called. If the class implementing Validator has a javax.faces.application.ResourceDependencies annotation, the
action described in ResourceDependencies must be taken
when javax.faces.component.EditableValueHolder#addValidator
is called.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | NOT_IN_RANGE_MESSAGE_ID
The message identifier of the |
| Modifier and Type | Method and Description |
|---|---|
| public void | validate(FacesContext
FacesContext for the request we are processing context, UIComponent UIComponent we are checking for correctness component, T the value to validate value)Perform the
correctness checks implemented by this |
| NOT_IN_RANGE_MESSAGE_ID | back to summary |
|---|---|
| public static final String NOT_IN_RANGE_MESSAGE_ID
Deprecated Use The message identifier of the | |
| validate | back to summary |
|---|---|
| public void validate(FacesContext context, UIComponent component, T value) throws ValidatorException Perform the
correctness checks implemented by this For a validator to be fully compliant with Version 2 and later
of the specification, it must not fail validation on
| |