Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 jsf h:dataTable在4列上_Jsf 2 - Fatal编程技术网

Jsf 2 jsf h:dataTable在4列上

Jsf 2 jsf h:dataTable在4列上,jsf-2,Jsf 2,我有以下简单的代码: 它打印出一些标签,但它显示 只有两列 但在panelGrid中,我已经指定了 columns=4 我想要4列而不是2列 守则: <p:tab title="Details Udfs" rendered="#{errorContractBean.flagMoneyD}"> <h:panelGrid id="detailsudfM" columns="4" cellpadding="5" sty

我有以下简单的代码:

它打印出一些标签,但它显示 只有两列

但在panelGrid中,我已经指定了

  columns=4
我想要4列而不是2列

守则:

        <p:tab title="Details Udfs" rendered="#{errorContractBean.flagMoneyD}">  
                    <h:panelGrid id="detailsudfM" columns="4" cellpadding="5" style="margin-bottom:5px" styleClass="grid">
                            <h:dataTable var="o" value="#{errorContractBean.liM}">
                            <h:column>
                                    <h:outputText value= "#{o.udf}"/>
                            </h:column>
                            <h:column>
                                    <h:outputText  value= "#{o.value}" style="font-weight:bold;"/>
                            </h:column>
                           </h:dataTable>                           
                    </h:panelGrid>
                </p:tab>  

电流输出:

期望输出:


面板网格实际上有4列,但在第一行和第一列中有datatable,datatable只有2列。我认为你不应该在这里使用数据表。改用facelets
c:forEach
-标记。请尝试以下操作:

<h:panelGrid columns="4">
    <c:forEach var="o" items="#{errorContractBean.liM}">
        <h:outputText value= "#{o.udf}"/>
        <h:outputText value= "#{o.value}" style="font-weight:bold;"/>
    </c:forEach>
</h:panelGrid>


名称空间c来自哪里?我没有它这是JSTL核心标记的名称空间。使用
xmlns:c=”http://java.sun.com/jsp/jstl/core“