Creating and Registering a New Validator Method on a Component
To bind to a new validator method in a new or existing backing bean:
-
In the Visual Editor, select the input component on which you wish to
add a new bean and method.
-
In the Property Inspector, click the column next to the
Validator property, then click
to display the Validator dialog.
-
To create a new method in an existing bean, select a name from the
Managed Bean dropdown list. Go to step 5.
-
To create a new bean and method, click N
ew... next to the Managed Bean dropdown list. Enter the
required information in the Create Managed Bean dialog. Click
Help if you need more information about using the dialog. Make sure
you check the Generate Java File
box, then click OK. The Validator dialog
redisplays.
-
Click New... next to the Method
dropdown list. The New Method dialog displays.
-
Enter a method name and click OK. The
Validator dialog redisplays.
-
Click OK.
-
To add code for the new method, open the
.java
file by
double-clicking its filename in the Application Navigator. Type the
code for the new method, then save the file.
Code sample
<h:selectOneMenu ...
validator="#{MyBean.somevalidatemethod}">
...
</h:selectOneMenu>
Related topics
About Custom JSF Validators
Registering a Custom Converter or Validator in an Application
Registering a Custom Validator on a Component
Referencing an Existing Bean Method That Performs Validation
Registering a Standard Validator on a Component
Copyright © 1997, 2004, Oracle. All rights reserved.