

Another typical use case for the RESOURCE_PHASE is for an individual portlet to generate non-HTML content (for download purposes) such as a PDF or spreadsheet document. One typical use case for the RESOURCE_PHASE is for an individual portlet to process Ajax requests. The other new phase added by the Portlet 2.0 standard is the _PHASE, in which the portlet container asks a specific portlet to perform resource-related processing. The typical use case for the EVENT_PHASE is to achieve inter-portlet communication (IPC), whereby two or more portlets on a portal page share data in some way.

During this phase, the portlet container asks each portlet to process events that it is interested in. The first is the _PHASE, in which the portlet container broadcasts events that are the result of an HTML form submission. The Portlet 2.0 standard adds two more lifecycle phases that define the execution of a portlet.

When the portal receives an HTTP POST request, the portlet container executes the portlet lifecycle and the portlet associated with the HTML form submission will first undergo the ACTION_PHASE before the RENDER_PHASE is invoked for all of the portlets on the page. When the portal receives an HTTP GET request for a portal page, the portlet container executes the portlet lifecycle and each of the portlets on the page undergoes the RENDER_ PHASE. In fact, the entire concept of ExternalContext was brought to JSF by IBM EG member Brendan Murray as a way to allow JSF to run well in a portlet environment. JSF 1.0 was being developed simultaneously with Portlet 1.0, so there was ample opportunity for the teams to collaborate. EXPERT GROUP INSIGHT It’s no accident that the RENDER_PHASE and the ACTION_ PHASE correspond nicely to Lifecycle.render( ) and Lifecycle.execute ( ) in JSF.
