Understanding the life cycle of a Faces page
In Chapter 14, Server-Side Coding with Jakarta, we saw the basic life cycle of web apps that employ servlets. Simply put, a submit request is made to a servlet, the servlet receives data from the page in the form of a request object, and you code whatever tasks are necessary, and then a response is returned either from the servlet or as an HTML or JSP page. Faces works differently from this.
There are six parts to the life cycle of a Faces page that begins with a request for a .jsf
page. Here is a diagram that shows the steps in the Faces life cycle:
Figure 15.4 – The Faces life cycle
Let’s review each part:
- Restore View: When a request arrives, it is checked for a query string. If it is not present, then this is likely the first time this page is requested. This means that the page can be rendered without the need to go through any of the other phases.
- Apply Request Values: In this...