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

6 thoughts on “JSF datatable getter is called even if it is not rendered

  1. I also noticed this and I don’t think this is expected behaviour.
    It doesn’t make sense the getter gets called.

    EL of components shouldn’t be evaluated whenever rendered attribute is set to false. Just my 2 cents …

  2. Hello,

    Is getter called in RENDER_RESPONSE phase? All getters get called in RESTORE_VIEW phase because view has to be restored at first and the “rendered” attribute can not be yet evaluated in this phase.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s