Name

<f:validator>

Synopsis

This action creates an instance of the class registered with the specified validator ID, which must implement the javax.faces.validator.Validator interface, and associates it with the component represented by the closest JSF component parent action element.

For an alternative, see the validator attribute for HTML library actions that represents JSF input components.

Syntax

<f:validator validatorId="validatorId" />

Attributes

Attribute name

Java type

EL expression type

Description

validatorId
String

Any

The ID used to register a class implementing the Validator interface.

Example

<h:form>
  <h:inputText value="#{user.ssn}">
    <f:validator validatorId="ssnValidator" />
  </h:inputText>
</h:form>

Get JavaServer Faces 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.