In my JSF2 application I have a phaselistener that needs to be executed before RENDER_RESPONSE but after JSF has built the viewroot.
First, what I did is register my PhaseListener in faces-config. The listener then gets called, but when I perform the beforePhase, getViewRoot().getChildren()
is still empty.
Secondly, I found how to do this by adding the following on my xhtml pages:
<f:phaseListener type="be.application.PolicyController" />
This works fine, but adding this to each of my pages would be extremely tedious. Hence I'm looking for a possibility to do this once for my application.
Any ideas how this can be done?
Register a system event listener for the
PreRenderViewEvent
in faces-config:Example of a listener:
using
in a template (facelets) works fine for me. Or are there any problems I'm not aware of..? (I hated this faces-config.xml thingy in jsf and try to avoid it completely in jsf2)