webtier@glassfish.java.net

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

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Mon, 15 Mar 2010 10:46:06 -0400

It might be overkill for you, but you could try our
http://ocpsoft.com/prettyfaces/ extension for JSF. It enables page-load
actions and bookmarking support.

Also, JBoss Seam 3 will be supporting JSF page actions as soon as we get the
beta out :)

--Lincoln


On Mon, Mar 15, 2010 at 8:22 AM, <webtier_at_javadesktop.org> wrote:

> You might try the following approaches:
>
> 1. Make the bean view-scoped, so that it doesn't get re-constructed on each
> postback. (In case you prefer CDI, here's an article on adding the
> @ViewScoped context to CDI:
> http://www.verborgh.be/articles/2010/01/06/porting-the-viewscoped-jsf-annotation-to-cdi/
> )
>
> 2. Manually check whether the request is a postback:
>
> [code]
> @PostConstruct
> public void init() {
> if (!FacesContext.getCurrentInstance().isPostback()) {
> ...do some initialization here...
> }
> }
> [/code]
>
> There might be other approaches too.
>
> I won't try to assess their merits and drawbacks right now. I only wanted
> to share what first came to mind.
> [Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=391916
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"