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 08:21:48 PDT

Cool! I didn't even know that a "preRenderView" event was available. It's not listed here: http://java.sun.com/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/index.html

So, in general, it's really better to listen to this event.

However, the problem that had to be solved explicitly stated that there had to be "one-time executed code", so I think the solution has to involve either checking whether the current request is a postback, or not posting back at all (that is, a direct GET link to another view).

The concrete problem can be solved with @PostConstruct too, but it might be cleaner to listen to the event.
[Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]

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