Globally Customizing the ADF Page Lifecycle
To globally customize the ADF Page Lifecycle, do the following:-
Create a class that extends
oracle.adf.controller.faces.lifecycle.FacesPageLifecycle
-
Create a class that extends
ADFPhaseListener
and overrides thecreatePageLifecycle()
method to return an instance of your custom page lifecycle class.
-
Change your
faces-config.xml
file to use your subclass ofADFPhaseListener
instead of the defaultADFPhaseListener
. As shown in Figure 10-12, you can do this on the Overview tab of the JDeveloperfaces-config.xml
editor, in the Life Cycle category.
Note:
Make sure to replace
the existing ADFPhaseListener with your custom subclass of
ADFPhaseListener, or everything in the JSF / ADF lifecycle coordination
will happen twice!
|
SRDemoPageLifecycle
class that globally overrides the reportErrors()
method of the page lifecycle to change the default way that exceptions
caught and cached by the ADF Model layer are reported to JSF. The
changed implementation reduces the exceptions reported to the user to
include only the exceptions that they can directly act upon, suppressing
additional "wrapping" exceptions that will not make much sense to the
end user.
Customizing the Page Lifecycle for a Single Page
You can customize the lifecycle of a single page setting theControllerClass
attribute of the pageDefinition to identify a class that either:
-
Extends
oracle.adf.controller.v2.PageController
class
-
Implements
oracle.adf.controller.v2.PagePhaseListener
interface
ControllerClass
attribute can either be:
-
A fully qualified class name
-
An EL expression that resolves to a class that meets the requirements above
ControllerClass
,
it is possible to specify the name of a custom page controller class
(or page phase listener implementation) that you've configured as a
managed bean in the faces-config.xml
file. This includes a backing bean for a JSF page, provided that it either extended PageController
or implements PagePhaseListener
.
Figure 10-13 illustrates how to select the root node of the page definition in the Structure window to set.
Note:
When using an EL expression for the value of the ControllerClass attribute, the Structure window may show a warning, saying the "#{ YourExpr ession} " is not a valid class. You can safely ignore this warning.
|