Download free message conversion process xml

About the Conversion and Validation Process in JSF

First let's look at the process in the context of JavaServer Faces (JSF) life cycle phases. When the form with a filled in date field is submitted, the browser sends a request value to the server. The request value is first stored in a component object in the Apply Request Values phase as the submitted string value. In the Process Validations phase, the submitted string value is converted to a local value of the appropriate object type that is required by the application. If validation correctness checks are required, the local value is then validated against the defined rules. For example a validator might check that a user supplied date is later than the current date.

If validation or conversion fails, JSF invokes the Render Response phase and redisplays the current page. As an application developer, you need to add h:message tags to display the validation or conversion error. Suppose validation and conversion are successful, then the Update Model phase starts and the converted and validated local value is used to update the model.

For more information about the JSF life cycle phases, see XXX.

If the component has one or more attached validators, the validate() method first checks for a submitted value if the required attribute of the component is set to true. If the value is null or a zero-length string, the component is invalidated and an error message is placed in the queue. If there are other validators registered on the component, they are not called at all and the current page is redisplayed. If the submitted value is a non-null value or a string value of at least one character, the validation process continues and the validators are called one at a time.

If all validations are successful, the Update Model Values phase starts and the local value is used to update the model. If one of the validation fails, the current page is redisplayed. By using a local value, JSF ensures that the model is not updated until all validations have passed successfully.

A JSF application can save the state of validators and components between requests on either the client or the server. For more information, see XXX.