Reputation: 15359
Environment: Seam, Richfaces
The following code snippet causes the method getUsers to be called multiple times, how do I avoid this in my application so that it gets called only once.
<c:forEach items="#{userHome.getUsers()}" var="_user">
</c:forEach>
Upvotes: 0
Views: 550
Reputation: 597402
A rule of thumb is to avoid <c:
tags when using JSF (unless you are sure they work as expected)
Here you'd better replace it with:
<a4j:repeat value="#{userHome.users}" var ="_user">
</a4j:repeat>
(or <ui:repeat>
if using facelets)
PS: I guess getUsers()
is JBoss' EL-extension, but I'd suggest not to use its extended features unless really needed.
Upvotes: 5
Reputation: 24517
And for the love of god, if you care about performance avoid using the EntityHome/Query framework. Just put a breakpoint or output on your getResultList()
and see how many times it is being called. Now try the same think with a normal seam component. You will see a significant change(!)
Upvotes: 2