First page Back Continue Last page Graphics

The request parameter values are converted to the expected data types.


JSF Request Life Cycle: Process Validation

The first event handling of the life cycle takes place after the Apply Request Values phase. At this stage, each component’s values are validated against the application’s validation rules. The validation rules can be predefined (shipped with JSF) or defined by the developer. Values entered by the user are compared to the validation rules. If an entered value is invalid, an error message is added to FacesContext, and the component is marked invalid. If a component is marked invalid, JSF advances to the Render Response phase, which displays the current view with the validation error messages. If there are no validation errors, JSF advances to the Update Model Values phase.

Conversion also occurs during the Process Validations phase. For example, if the field is bound to an Integer property, the value is converted to an Integer. If the value conversion fails, an error message is generated and queued in FacesContext, where it is displayed during the Render Response phase, along with any validation errors. The converted value is then stored in the component.

At the end of the Process Validations phase, new component values are set, any validation or conversion error messages and events are queued in FacesContext, and any value change events are delivered.