Configuring phase listeners
As the name suggests, a phase listener is capable to listen to the start and end of each of the six JSF life-cycle phases (a detailed diagram of how JSF phases interact with each other is available in Appendix, The JSF Life Cycle):
- Restore the View phase
- Apply the Request Values phase
- Process the Validations phase
- Update the Model Values phase
- Invoke the Application phase
- Render the Response phase
You can easily capture the events of each phase by following these three steps:
- Implementing the
PhaseListener
interface. - Overriding the
afterPhase
,beforePhase
, andgetPhaseId
methods. - Configuring the phase listener in
faces-config.xml
.
A good point to start is a simple but useful PhaseListener
that can be used to debug the phases. ...
Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.