Registering a Custom Validator

If the application developer provides an implementation of the Validator interface to perform the validation, you must register this custom validator in the application configuration resource file by using the validator XML element:

<validator>
  ...
  <validator-id>FormatValidator</validator-id>
  <validator-class>
    validators.FormatValidator
  </validator-class>
  <attribute>
    ...
    <attribute-name>formatPatterns</attribute-name>
    <attribute-class>java.lang.String</attribute-class>
  </attribute>
</validator>

The validator-id and validator-class elements are required subelements. The validator-id represents the identifier under which the Validator class should be registered. This ID is used by the tag class corresponding to ...

Get The J2EE™ Tutorial Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.