问题描述
我具有返回Collection<List<Produit>>
。
public Collection<List<Produit>> parProduit(String cat) throws IOException {
HashMap<Integer, List<Produit>> legaux = new HashMap<Integer, List<Produit>>();
...............
return new ArrayList<>(legaux.values());
}
我的看法 :
<h:dataTable value="#{listModule.toArray()}" var="entry">
<h:column>
<f:facet name="header">
<h:outputText value="Module" />
</f:facet>
<h:dataTable value="#{entry}" var="e">
<h:column>
<f:facet name="header">
<h:outputText value="cool : #{entry}" />
</f:facet>
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
在这种情况下,我只得到Collection的所有对象:
我想知道如何获取每个对象的所有属性。
1楼
两件事情:
-
在Produit中,实现
toString()
方法,该方法返回要在页面上显示的内容。 -
在您尝试打印出
cool : <produit info>
的行的HTML模板中,将#{entry[0]}
替换为#{e}
cool : <produit info>