JSF datatable getter is called even if it is not rendered

Hi,

if you have a code like this:

<h:dataTable value=”#{bean.texts}” rendered=”false”/>

and your Bean.java as

public List getTexts(){
System.out.println(“getTexts getter called”);
return new ArrayList();
}

the getter is still called even if the datatable is not rendered. This does not happen in inputText or outputText etc.

I have to learn taht in JSF I can never trust the getters 😉

Advertisements

JSF 2.0 viewscope not working when there is navigation to same page

Self note to myself,

if there is a navigation defined for an action that is staying at the same page, view scope will not work in JSF 2.0.

Because as there is navigation, viewroot will be created again and the viewscope will work like request scope. If you will be in the same page, do not use a navigation 🙂