Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF -- Alternative to "rendered="?

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?

like image 454
Shadowman Avatar asked Jun 29 '10 14:06

Shadowman


1 Answers

If the getter does nothing else than just returning a (cached) boolean property, then I really don't see any pains. There's no alternative 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.

like image 103
BalusC Avatar answered Nov 16 '22 02:11

BalusC