O'Reilly logo

Mastering JavaServer Faces 2.2 by Anghel Leonard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. Implementing the PhaseListener interface.
  2. Overriding the afterPhase, beforePhase, and getPhaseId methods.
  3. 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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required