Simple piece of code about dataTable
. CentralFeed
is SessionScoped Bean, and PostComment
is RequestScoped Bean
Yes, getters can be called multiple times during a request. It doesn't harm as long as it does its sole job properly: returning the bean property. However, in your example you're loading the list straight in the getter method! This should be avoided. Initializing/loading of the model should go in bean's constructor or @PostConstruct
or any event based methods like the action method. They get called only once. The getters should only return model data and nothing more (apart from some trivial logging or lazy loading).