webtier@glassfish.java.net

Re: Where to put one-time executed code on JSF page load

From: <webtier_at_javadesktop.org>
Date: Tue, 16 Mar 2010 02:40:38 PDT

The cleanest solution would look like

<f:metadata>
        <f:event type="preRenderView" listener="#{myController.preRenderView}" />
</f:metadata>

The handler is executed BEFORE rendering the view, the code has the choice of rendering an other view in case of exceptions or due to application state.

This would not be possible, if you are using the @PostConstruct initializer, because this one gets instantiated DURING rendering.


br, Sven
[Message sent by forum member 'tzwoenn' (tzwoenn_at_gmx.de)]

http://forums.java.net/jive/thread.jspa?messageID=392110