Referencing an Existing Bean Method That Performs Validation

To reference an existing bean method that performs custom validation:

  1. In the Visual Editor, select the component on which you wish to use a bean method for performing validation checks.
  2. In the Property Inspector, click the column next to the validator property, then click ellipsis button .

    A dialog appears for you to select a managed bean name and the method that performs validation.

  3. Select the required name and method from the dropdown lists. For more information, click Help in the dialog. When done, click OK.

    This inserts the validator attribute on the selected component.

Code sample

<h:inputText id="date" 
             value="#{MyBean.date}" ... 
             validator="#{MyBean.validateDate}" />     

About Custom JSF Validators
Registering a Custom Converter or Validator in an Application
Registering a Custom Validator on a Component
Creating and Registering a New Validator Method on a Component
Registering a Standard Validator on a Component