9 Replies Latest reply on Apr 29, 2011 12:02 PM by Nick Belaevski

    How to walk the viewroot before render response?

    Steven De Groote Newbie

      For various reasons, I need to change some attributes on a few components before my facelet is rendered to the browser. Hence, I'm doing this in beforePhase of RENDER_RESPONSE, and it works nicely on a POST request (so when running through the completely JSF lifecycle).


      However... I want to also apply my rules when I request a page for the first time. In that case, jsf processing jumps immediately to render_response, and in the beforephase of that, the ViewRoot is not filled in (it doesn't have any child components).


      I tried adding a public buildView() method to the faceletviewhandler, but I have now found that org.ajax4jsf.event.InitPhaseListener wraps it with an AjaxViewHandler, hard coded in the phase listener.


      Hence a few questions:

      - Is there a way that I can build the viewroot earlier, even on a normal GET request?

      - Or how can I implement my own InitPhaseListener to make sure it can use my own ViewHandler?