views:

76

answers:

3

We're developing a Java web app that utilizes JSF (Richfaces through Seam) for its UI. I've read several articles that indicate that using the "rendered=" attribute on UI components results in a pretty substantial performance hit. We have several components that we'd like to enable or disable based on whether or not their values are set. For example, if we're displaying an item for sale we wouldn't have a bunch of blank fields for attributes that are not set.

Given this performance hit, however, we're apprehensive about using multiple "rendered" fields. Is there a better performing alternative to this? Is there anything we can do to improve the performance of using this field?

+2  A: 

If the getter does nothing else than just returning a (cached) boolean property, then I really don't see any pains. There's no altarnative to it. Best what you could to to improve the performance is to cache it in either the model (lazy loading) or the view (c:set). The cost of getter method invocation in turn is fully negligible.

BalusC
but be careful with `<c:set>` - it might not work as expected on some versions and some cases (iteration)
Bozho
Thanks for your input. If the performance hit is negligible, then we'll make use of it.
Shadowman
A: 

Any other way wouldn't be free anyways.. so I would just use the standard JSF way to hide/show components.

Max Katz
A: 

you can use style="display : (#{bean.booleon} ? block : none)" jsf tag.

taher