When
a page is submitted and a new page requested, the application invokes both the
ADF Faces page
lifecycle,
which extends the standard JSF request lifecycle, and the
ADF page lifecycle.
ADF Faces page lifecycle (extended JSF lifecycle)
The
extended JSF lifecycle handles submitting the values on the page, validating
component values, navigating pages, displaying components on the resulting
page, and saving and restoring state.
The
JSF lifecycle phases use a UI component tree to manage the display of the faces
components. This tree is a runtime representation of a JSF page: each UI
component tag in a page corresponds to a UI component instance in the tree.
The
FacesServlet servlet manages the
request processing lifecycle in JSF applications. FacesServlet creates an
object called FacesContext,
which contains the information necessary for request processing, and invokes an
object that executes the lifecycle.
For
more details about the extended JSF lifecycle, see the "Understanding the
JSF and ADF Faces Lifecycles" chapter of the Oracle Fusion Middleware Web
User Interface Developer's Guide for Oracle Application Development Framework.
ADF page lifecycle
The
ADF page lifecycle handles preparing and updating the data model, validating
the
data at the model layer, and executing methods on the business layer.
The
ADF page lifecycle uses the binding container to make data available for easy
referencing by the page during the current page request.
The
combined JSF and ADF page lifecycle is only one sequence within a larger sequence
of events that begins when an HTTP request arrives at the application server and
continues until the page is returned to the client. This overall sequence of
events can be called the web page lifecycle. It follows processing through the
model, view, and controller layers as defined by the MVC architecture. The page
lifecycle is not a rigidly defined set of events, but is rather a set of events
for a typical use case.
Figure
21–1shows a sequence diagram of the lifecycle of a web page request using JSF
and Oracle ADF in tandem.
The
basic flow of processing a web page request using JSF and Oracle ADF happens as
follows:
1. A web request for
http://yourserver/yourapp/faces/some.jsp arrives from the client to the
application server.
2.
The ADFBindingFilter object looks for the ADF binding context in
the HTTP session, and if it is not yet present, initializes it for the first time.
Some
of the functions of the ADFBindingFilter include finding the name of the
binding context metadata file, and finding and constructing an instance of each data control.
3.
The ADFBindingFilter object invokes the beginRequest() method on each data
control participating in the request. This method gives the data control a notification
at the start of every request so that it can perform any necessary setup.
4.
The JSF Lifecycle object, which is responsible for orchestrating the standard processing
phases of each request, notifies the ADFPhaseListener class during each phase
of the lifecycle, so that it can perform custom processing to coordinate the
JSF lifecycle with the ADF Model data binding layer. For more information about
the details of the JSF and ADF page lifecycle phases, see Section 21.2,
"The JSF and ADF Page Lifecycles." The JSF and ADF Page Lifecycles Understanding
the Fusion Page Lifecycle 21-3
5.
The ADFPhaseListener object creates an ADF PageLifecycle object to
handle
each request and delegates appropriate before and after phase methods to
corresponding
methods in the ADF PageLifecycle class. If the appropriate
binding
container for the page has never been used before during the user's
session,
it is created.
6.
The first time an application module data control is referenced during the
request, it acquires an instance of the application module from the application
module pool.
7.
The JSF Lifecycle object forwards control to the page to be rendered.
8.
The UI components on the page access value bindings and iterator bindings in
the page's binding container and render the formatted output to appear in the browser.
9.
The ADFBindingFilter object invokes the endRequest() method on each data control
participating in the request. This method gives a data control notification at
the end of every request, so that they can perform any necessary resource
cleanup.
10.
An application module data control uses the endRequest notification to release the
instance of the application module back to the application module pool.
11.
The user sees the resulting page in the browser.
The
ADF page lifecycle also contains phases that are defined simply to notify ADF page
lifecycle listeners before and after the corresponding JSF phase is executed
(that is, there is no implementation for these phases). These phases allow you
to create custom listeners and register them with any phase of both the JSF and
ADF page lifecycles, so that you can customize the ADF page lifecycle if
needed, both globally or at the page level.
No comments:
Post a Comment