Documentation
JSFToolbox

Search 

Contents

  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
Selected 12. JSF Tag Reference

12. JSF Tag Reference

Contents > JSF Tag Reference > JSF Core Tags

10. JSF Core Tag Reference

Contents > JSF Core Tag Reference > f:validator

f:validator

The Validator tag registers a named Validator instance on the component associated with the enclosing tag. The JavaServer Faces framework includes three standard validators (see the validateDoubleRange, validateLength, and validateLongRange tags) but the Validator interface can be implemented by classes that provide custom validation for your application. This tag accepts one value matching the validator ID you assigned to your validator class in your Faces configuration file. The body content of this tag must be empty.

Example:

<h:inputText id="emailAddress" value="#{customerBean.customer.emailAddress}">
  <f:validator validatorId="emailAddressValidator" />
</h:inputText> 
<h:message for="emailAddress" />

HTML Output

<input id="form:emailAddress" name="form:emailAddress" type="text" value="fake@email"/>
Invalid email address.

Tag Attributes

validatorId String
Required
The validatorId attribute sets the validator identifier of the Validator to be created and registered. It must match exactly the value of one of the validator-id element of a validator in your Faces configuration file.