Search code examples
javajsfjsf-2xhtmlicefaces

Access data by variable JSF


I have an xhtml file, with a backing bean, i'd like to create a table dynamically. I'm able to create the columns dynamically, but how can i acces the item variable's heading property. I mean, if there is the "Stock" string in the headings variable (so this will be the heading of the columns), than how can I acces the item.stock data?

XHTML:

            <ice:dataTable value="#{tableBean.carInventory}" var="item">                    
                <ice:columns value="#{tableBean.showableCols}" var="headings">                                        
                    <f:facet name="header">
                        <h:outputText value="#{headings}"/>
                    </f:facet>
                    <ice:outputText value="#{item.?????headings??????}"/>
                </ice:columns>
            </ice:dataTable>

Solution

  • So I can't accept a comment, so i have to write one, the answer is using: #{item[headings]}, thanks to eljunior