Configuring validators and converters

Data validation is an important part of a JSF application (which has existed since JSF 1.2), because it allows us to separate the business logic from the tedious checks that help us to obtain only valid information from the user. Data is validated in the Process Validations phase (if the immediate attribute is set to true, this processing will occur at the end of the Apply Request Values phase instead) and should be valid and ready to be used before the Update Model Values phase.

Besides the built-in validators, we can write our own customized validators. A public class that implements the Validator interface and overrides the validate method is recognized by JSF as a validator. There are two ways to configure ...

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