当前位置: 代码迷 >> java >> 收集和数据表
  详细解决方案

收集和数据表

热度:61   发布时间:2023-07-25 19:02:00.0

我具有返回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()方法,该方法返回要在页面上显示的内容。
  2. 在您尝试打印出cool : <produit info>的行的HTML模板中,将#{entry[0]}替换为#{e} cool : <produit info>
  相关解决方案