The JSF framework includes built-in support for rendering validation error messages when form validation fails. These messages are typically rendered using the<h:message>
or<h:messages>
tags. When a JSF form is posted to the server, the JSF framework's request processing lifecycle includes the following phases:
1. Restore the UI component tree for the view.
2. Apply the incoming form data to the UI components in the tree.
3. Attempt to convert and validate the data.
4. If the conversion/validation is successful, update the application's model.
5. Invoke the backing bean method associated with the component that submitted the form.
6. Send the response back to the client.
When a conversion or validation error causes the conversion and validation phase to fail, the JSF framework sends back a response containing request-scoped FacesMessage
objects containing the validation messages for the invalid fields. As these message objects are request scoped...