Copying the content from Oracle developer's guide which describes all phases of JSF lifecycle -
In a JSF application that uses the ADF Model layer, the phases in the page lifecycle are as follows:
Source - Oracle Developer's Guide
In a JSF application that uses the ADF Model layer, the phases in the page lifecycle are as follows:
- Restore View: The URL for the requested page is passed to the
bindingContext
object, which finds the page definition file that matches the URL. The component tree of the requested page is either newly built or restored. All the component tags, event handlers, converters, and validators on the submitted page have access to theFacesContext
instance. If the component tree is empty, (that is, there is no data from the submitted page), the page lifecycle proceeds directly to the Render Response phase.
If any discrepancies between the request state and the server-side state are detected, an error will is thrown and the page lifecycle jumps to the Render Response phase. - JSF Restore View: Provides before and after phase events for the Restore View phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Restore View phase. The Initialize Context phase of the ADF Model page lifecycle listens for the
after(JSF Restore View)
event and then executes. The ADF Controller uses listeners for the before and after events of this phase to synchronize the server-side state with the request. For example, it is in this phase that browser back button detection and bookmark reference are handled. After the before and after listeners are executed, the page flow scope is available. - Initialize Context: The page definition file is used to create the
bindingContainer
object, which is the runtime representation of the page definition file for the requested page. TheLifecycleContext
class used to persist information throughout the ADF page lifecycle phases is instantiated and initialized with values for the associated request, binding container, and lifecycle. - Prepare Model: The ADF page lifecycle enters the Prepare Model phase by calling the
BindingContainer.refresh(PREPARE_MODEL)
method. During the Prepare Model phase,BindingContainer
page parameters are prepared and then evaluated. If parameters for a task flow exist, they are passed into the flow.
Next, any executables that have their refresh attribute set toprepareModel
are refreshed based on the order of entry in the page definition file's<executables>
section and on the evaluation of theirRefreshCondition
properties (if present). When an executable leads to an iterator binding refresh, the corresponding data control will be executed, and that leads to execution of one or more collections in the service objects. If an iterator binding fails to refresh, a JBO exception will be thrown and the data will not be available to display. For more information, see Section 19.2.1, "What You May Need to Know About Using the Refresh Property Correctly".
If the incoming request contains noPOST
data or query parameters, then the lifecycle forwards to the Render Response phase.
If the page was created using a template, and that template contains bindings using the ADF Model layer, the template's page definition file is used to create the binding container for the template. The container is then added to the binding context.
If anytaskFlow
executable bindings exist (for example, if the page contains a region), thetaskFlow
binding creates an ADF ControllerViewPortContext
object for the task flow, and any nested binding containers for pages in the flow are then executed. - Apply Request Values: Each component in the tree extracts new values from the request parameters (using its decode method) and stores those values locally. Most associated events are queued for later processing. If you have set a component's
immediate
attribute totrue
, then the validation, conversion, and events associated with the component are processed during this phase and the lifecycle skips the Process Validations, Update Model Values, and Invoke Application phases. Additionally, any associated iterators are invoked. For more information about ADF Faces validation and conversion, see the "Validating and Converting Input" chapter in the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.
- JSF Apply Request Values: Provides before and after phase events for the Apply Request Values phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Apply Request Values phase.
- Process Validations: Local values of components are converted and validated on the client. If there are errors, the lifecycle jumps to the Render Response phase. At the end of this phase, new component values are set, any validation or conversion error messages and events are queued on
FacesContext
, and any value change events are delivered. Exceptions are also caught by the binding container and cached. - JSF Process Validations: Provides before and after phase events for the Process Validations phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Process Validations phase.
- Update Model Values: The component's validated local values are moved to the model and the local copies are discarded. For any updateable components (such as an
inputText
component), corresponding iterators are refreshed, if the refresh condition is set to the default (deferred
) and the refresh condition (if any) evaluates totrue
.
If you are using a backing bean for a JSF page to manage your UI components, any UI attributes bound to a backing bean property will also be refreshed in this phase. - JSF Update Model Values: Provides before and after phase events for the Update Model Values phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Update Model Values phase.
- Validate Model Updates: The updated model is now validated against any validation routines set on the model. Exceptions are caught by the binding container and cached.
- Invoke Application: Any action bindings for command components or events are invoked.
- JSF Invoke Application: Provides before and after phase events for the Invoke Application phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Invoke Application phase.
- Metadata Commit: Changes to runtime metadata are committed.
- Initialize Context (only if navigation occurred in the Invoke Application lifecycle): The Initialize Context phase listens for the
beforeJSFRenderResponse
event to execute. The page definition file for the next page is initialized. - Prepare Model (only if navigation occurred in the Invoke Application lifecycle): Any page parameters contained in the next page's definition are set.
- Prepare Render: The binding container is refreshed to allow for any changes that may have occurred in the Apply Request Values or Validation phases. Any iterators that correspond to read-only components (such as an
outputText
component) are refreshed. TheprepareRender
event is sent to all registered listeners, as is theafterJSFRenderResponse
event.
Note:Instead of displayingprepareRender
as a valid phase for a selection, JDeveloper displaysrenderModel
, which represents therefresh(RENDER_MODEL)
method called on the binding container. - Render Response: The components in the tree are rendered as the Java EE web container traverses the tags in the page. State information is saved for subsequent requests and the Restore View phase.
In order to lessen the wait time required to display both a page and any associated data, certain ADF Faces rich client components such as thetable
component, use data streaming for their initial request. When a page contains one or more of these components, the page goes through the normal lifecycle. However, instead of fetching the data during that request, a special separate request is run. Because the page has just rendered, only the Render Response phase executes for the components that use data streaming, and the corresponding data is fetched and displayed. If the user's action (for example scrolling in a table), causes a subsequent data fetch another request is executed. Tables, trees, tree tables, and data visualization components all use data streaming. - JSF Render Response: Provides before and after phase events for the Render Response phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Render Response phase.
Source - Oracle Developer's Guide
0 comments:
Post a Comment