Top Description Fields Constructors Methods
jakarta.faces.validator

public Class RequiredValidator

extends Object
implements Validator
Class Inheritance
All Implemented Interfaces
jakarta.faces.validator.Validator, java.util.EventListener
Imports
jakarta.faces.application.FacesMessage, jakarta.faces.component.UIComponent, .UIInput, jakarta.faces.context.FacesContext

A Validator that checks for an empty value in the same way that UIInput checks for a value. In fact, this validator is equivalent to setting the required attribute on the input component to true.

Since
2.0

Field Summary

Modifier and TypeField and Description
public static final String
VALIDATOR_ID

The standard converter id for this converter.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
validate(FacesContext
FacesContext for the request we are processing
context
,
UIComponent
UIComponent we are checking for correctness
component
,
Object
the value to validate
value
)

Implements jakarta.faces.validator.Validator.validate.

Verify that the converted object value is not null.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

VALIDATOR_IDback to summary
public static final String VALIDATOR_ID

The standard converter id for this converter.

Constructor Detail

RequiredValidatorback to summary
public RequiredValidator()

Method Detail

validateback to summary
public void validate(FacesContext context, UIComponent component, Object value)

Implements jakarta.faces.validator.Validator.validate.

Verify that the converted object value is not null.

Parameters
context:FacesContext

Doc from jakarta.faces.validator.Validator.validate.

FacesContext for the request we are processing

component:UIComponent

Doc from jakarta.faces.validator.Validator.validate.

UIComponent we are checking for correctness

value:Object

Doc from jakarta.faces.validator.Validator.validate.

the value to validate

Annotations
@Override
Exceptions
ValidatorException:
if validation fails