First page Back Continue Last page Text

oracle adf workshop


Using Phase Listeners

It is possible to create event listeners, called phase listeners, that are triggered at different stages of the JSF life cycle. This enables you to code processing that should occur, for example, prior to the rendering of a page.

Using a phase listener, you can listen for phase events for any of the ADF life-cycle phases, and execute your own code before and after the events. The basic steps for implementing your own phase listener in an ADF application are as follows:

1. Create a class that implements the javax.faces.event.PhaseListener interface.

2. Add your own functionality in the beforePhase() and afterPhase() methods of your class.

3. Use the Overview tab to register your listener with your faces-config.xml file.

You can accomplish similar functionality, but for a single page, by using a page phase listener that implements the oracle.adf.controller.v2.lifecycle.PagePhaseListener interface.