users@glassfish.java.net

Re: Prevent eval of JSF rendered attributes from previous page on PostBack?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Tue, 29 May 2007 09:50:50 -0700

glassfish_at_javadesktop.org wrote:
> We've developed a large JSF web app on Glassfish v1 and we're still struggling with this technology.
>
> Because JSF doesn't support action methods on GET requests, our JSF backing bean getters use a lazy fetch pattern to initialize themselves. To optimize memory utilization, most of those beans are request scope. The way JSF works on POST submits though, I understand it posts back to the previous page and then navigate to the next page. The problem is that during initial phases on the previous page, it evaluates again the rendered attributes of components and this triggers our lazy fetch logic, even though this is totally wasteful, since we're navigating away from those UI components. Needless to say it results in very poor performance!
>
> We tried to look for workarounds on the web and played around shielding our rendered attributes with isPostBack clauses hoping to bypass those evaluation on PostBack, but neither the JSF method, nor other creative implementation such as getRenderResponse() really works...
>
> Has anyone encountered this problem or can think of how to work around it?
> Are we supposed to always use session-scoped backing bean with JSF??
>
JSF is working as designed in this area, though I'm hoping it will be
changed for 2.0.
The current suggestions for working around this are:
  - session scoped beans
  - manipulate the rendered property of the component directly instead
of using expressions
    so that the component state saving takes care of the work for you
between requests
 
> I'd appreciate any suggestion. :-)
> [Message sent by forum member 'bouteill' (bouteill)]
>
> http://forums.java.net/jive/thread.jspa?messageID=219202
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>