webtier@glassfish.java.net

Conditionally rendering h:column

From: Uwe Seimet <Uwe.Seimet_at_seimet.de>
Date: Thu, 12 Nov 2009 18:41:01 +0100

Hello,

I have a question concerning the rendering of h:column. This JSP code
fragment does not work for me as far as the rendered attribute of
h:column is concerned:

<h:dataTable value="#{bean.items}" var="item">
  <h:column rendered="{item.rendered}">
    <f:facet name="header">
        <h:outputText value="Header" />
    </f:facet>
    <h:outputText value="{item.rendered}" />
  </h:column>
</h:dataTable>

Even though the expression {item.rendered} returns the boolean value "true"
the column is not rendered correctly. The actual column contents are
displayed ("true") but the header is missing. It looks as if the column
is in some kind of undefined state.

My guess is that I cannot refer to the model data of the current row
(i.e. #{item}) from within the 'rendered' attribute of h:column.
Can anybody confirm this or is there something else I have to consider?

Best regards

Uwe

-- 
-----------------------------------------------------------------------
  Dr. Uwe Seimet                                http://www.seimet.de/