Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getter called too many times

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a getter method:



I'm debugging the moment when this page loads and i don't know why getDataList method is called more than 10 times.... I can't understand where it is called from. I don't have this method call in other places in the page.
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your first mistake is in using JSTL on a JSF view. That almost always means you're not using JSF effectively, and in many cases, you can actually interfere with the proper operation of JSF.

Your second mistake was in not understanding the JSF lifecycle. It's quite normal for getters to get called multiple times on a view request. The main concern there is that the getter be exactly that: a method to get a value. If you try and throw additional logic into the get method, you'll see unfortunate side-effects.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, i know that during the lifecycle it calls getter more than one time, but not more than 10 times...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic