Registering a Standard Validator on a Component

To register a standard JSF validator on a component using a standard tag:

  1. In the Visual Editor, select the component on which you want to register a standard validator. Only values of UIInput components or components that extend UIInput can be validated.
  2. In the Component Palette, select JSF Core from the dropdown list, then click the standard validator of your choice (e.g., validateLength).
  3. In the Property Inspector, set the attributes for the validator. You can use literal values or value binding expressions in the attribute values. For information about the tag attributes, right-click the tag in the Palette and choose Help from the context menu.

Note: You can register more than one validator on a component. JavaServer Faces calls the validators in the order they are added to a component.

Code sample 1

<h:inputText id="zip" value="#{employee.zipCode}">
  <f:validateLength minimum="5" maximum="9"/>
</h:inputText>    

Code sample 2

<h:inputText id="bonus" value="#{employee.bonus}">
  <f:validateLongRange minimum="#{MyBean.miminum}"/>
</h:inputText>    

About Standard JSF Validators
Registering a Custom Validator on a Component
Reference: Standard JSF Converter and Validator Tags