In order to validate a component’s value using a particular validator, you need to register the validator on the component. You have three ways to do this:
Nest the validator’s corresponding tag (shown in Table 11–7) inside the component’s tag. Using the LongRangeValidator describes how to use the validateLongRange tag. You can use the other standard tags in the same way.
Refer to a method that performs the validation from the component tag’s validator attribute.
Nest a validator tag inside the component tag and use either the validator tag’s validatorId attribute or its binding attribute to refer to the validator.
See Referencing a Method That Performs ValidationReferencing a Method That Performs Validation for more information on using the validator attribute.
The validatorId attribute works similarly to the converterId attribute of the converter tag, as described in Converting a Component’s Value. See Binding Converters, Listeners, and Validators to Backing Bean Properties for more information on using the binding attribute of the validator tag.
Keep in mind that validation can be performed only on components that implement EditableValueHolder because these components accept values that can be validated.