How can I implement a PhaseListener which runs at end of the JSF lifecycle?
How can I implement a PhaseListener which runs at end of the JSF lifecycle?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to implement the
PhaseListenerinterface and hook onbeforePhase()of thePhaseId_RENDER_RESPONSE. The render response is the last phase of the JSF lifecycle.To get it to run, register it as follows in
faces-config.xml:Update the above phase listener is indeed applicaiton-wide. To have a phase listener for a specific view, use the
beforePhaseand/orafterPhaseattributes of the<f:view>.E.g.
with
A more JSF 2.0 way is by the way using the
<f:event type="preRenderView">:with