Re: f:selectItems seems not correctly

Splash Forums PrettyFaces Users f:selectItems seems not correctly Re: f:selectItems seems not correctly


Thats not necessarily a bug in the JSF implementation. Its typical for JSF that getters are called multiple times in the request lifecycle.

Therefore you should NEVER do expensive stuff (like database queries) in your getters. Instead make sure that the data is initialized correctly by either using something like PrettyFaces page actions or use some kind of lazy initialization like this:

public class ProvinceBean {

private List<Province> provinceList = null;

public List<Province> getProvinces() {

if(provinceList == null) {
provinceList = ....; // build list here

return provinceList;