Java Reference
In-Depth Information
</attribute>
</validator>
Attributes specified in a validator tag override any settings in the @FacesValid-
ator annotation.
The validator-id and validator-class elements are required subelements. The
validator-id element represents the identifier under which the Validator class
should be registered. This ID is used by the tag class corresponding to the custom val-
idator tag.
The validator-class element represents the fully qualified class name of the Val-
idator class.
The attribute element identifies an attribute associated with the Validator imple-
mentation. It has required attribute-name and attribute-class subelements.
The attribute-name element refers to the name of the attribute as it appears in the
validator tag. The attribute-class element identifies the Java type of the value
associated with the attribute.
Creating and Using a Custom Validator on page 128 explains how to implement the
Validator interface.
Using a Custom Validator ” on page 132 explains how to reference the validator from the
page.
Registering a Custom Converter
As is the case with a custom validator, if the application developer creates a custom con-
verter, you must register it with the application either by using the @FacesConvert-
er annotation, as described in Creating a Custom Converter ” on page 123 , or by using
the converter XML element in the application configuration resource file. Here is a
hypothetical converter configuration for CreditCardConverter from the Duke's
Bookstore case study:
Click here to view code image
<converter>
<description>
Converter for credit card numbers that normalizes
the input to a standard format
</description>
<converter-id>CreditCardConverter</converter-id>
<converter-class>
Search WWH ::




Custom Search