简体   繁体   中英

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>

所以我不能接受评论,所以我不得不写一个,答案是使用: #{item[headings]} ,感谢eljunior

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM