JSF - Validators

Java Conceptuel Diagram

About

Validators are used to validate the data that is received from the input components.

JavaServer Faces technology provides a set of standard classes and associated tags that page authors and application developers can use to validate a component’s data.

Referencing a Method That Performs Validation

If the input of one of the components on your page is validated by a managed bean method, refer to the method from the component’s tag by using the validator attribute.

<h:inputText id="myId" 
    value="#{myManagedBean.userNumber}" 
    required="true" size="3" 
    disabled="#{myManagedBean.number eq myManagedBean.userNumber}"
    validator="#{myManagedBean.validateNumberRange}">
</h:inputText>

where the managed bean method validateNumberRange verifies that the input value is within the valid range.

Documentation / Reference





Discover More
Jdeveloper Create Managed Bean
JSF - (Managed Bean|Controller)

Managed Beans (also known as model objects and controllers) are lightweight container-managed objects (POJOs) with minimal requirements. They support a small set of basic services, such as: resource...
Jdeveloper Faces Config Xml
JSF - faces-config.xml

Configuration file of JSF. Permits to manager the declaration and configuration of: Managed bean Navigation Rules Validators Converters ...
Java Conceptuel Diagram
Java - Server Side Components

Server-side components enable application developers to develop “business logic” and package it as a component that can be assembled into applications. JSF server-side objects: managed beans,...



Share this page:
Follow us:
Task Runner