[jboss-user] [JBoss Seam] - Problem with Backing Bean method being called multi-times

elikyip do-not-reply at jboss.com
Tue Jan 30 13:44:07 EST 2007


Hi,

I'm a newbie in seam, jsf, and all that jazz...

I've created a simple application and it's running fine with one exception.
The method in my backing bean that returns a list of items to display is being
called ONCE per LOOP in my jstl <c:forEach> loop. This is very inefficient as this
method is hitting the database every loop.

1) My question is why is that method being called every loop iteration. Shouldn't it be
called only once in the loop?

2) Am I doing something that I should not? If yes, can anyone tell me the right
way of doing this.


Any suggestions is highly appreciated !!


Backing Bean snippets...

@Name("FooBean");
@Scope(ScopeType.EVENT)
public class FooBean {
  ...
  public List getFooList() {
    // This method retrieves data from database and return it.
  }
  ...
}

xhtml JSTL snippets:
<c:forEach items="${FooBean.fooList}" var="foo">
  <!-- Display them -->
</c:forEach>

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008442#4008442

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008442



More information about the jboss-user mailing list