Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/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 使用ui水平显示列;在dataTable下的行中重复_Jsf 2_Primefaces - Fatal编程技术网

Jsf 2 使用ui水平显示列;在dataTable下的行中重复

Jsf 2 使用ui水平显示列;在dataTable下的行中重复,jsf-2,primefaces,Jsf 2,Primefaces,我使用的是primefaces数据表。datatable中的每一行都有24列,代表24小时值。到目前为止,我使用的是一个静态xhtml,有24列单独编码,我希望它是动态的,这样代码可以很容易地维护,列下的输入文本框从数组中获取。当我尝试在数组上使用时,我看不到列是水平创建的。PFA代码如下所示 在parent.xhtml中有dataTable <p:dataTable id="tbl" var="row" value="#{prvdr.values}" binding="#{pr

我使用的是primefaces数据表。datatable中的每一行都有24列,代表24小时值。到目前为止,我使用的是一个静态xhtml,有24列单独编码,我希望它是动态的,这样代码可以很容易地维护,列下的输入文本框从数组中获取。当我尝试在数组上使用时,我看不到列是水平创建的。PFA代码如下所示

在parent.xhtml中有dataTable

    <p:dataTable id="tbl" var="row" value="#{prvdr.values}" 
binding="#{prvdr.dataTable}" widgetVar="table" filteredValue="#{prvdr.filteredList}" 
scrollable="true" scrollWidth="auto" lazy="false" rowKey="#{row.id}" paginator="true" 
filterEvent="enter" paginatorTemplate="#{appmsg['label.recordsperpage']}: {RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15,20,50" editable="true" editMode="cell">
<ui:include src="hourly.xhtml" />

</p:dataTable>
我尝试了ui:repeat和c:forEach,但无法创建所需的视图。
欢迎您提供任何帮助和建议。

肯定不起作用,因为它不在视图生成期间运行,而仅在视图渲染期间运行。但是,
应该可以工作。你到底有什么问题?“无法创建所需视图”的语句太模糊。请从开发人员的角度详细说明具体问题。@BalusC,而不是上面的代码,我将其替换为。。。。但是这些列仍然不是水平创建的。
根本不会显示任何列,因为这是一种无效的方法。但是有了
你就真的看到了想要的列了吗?然而,只有布局不完全正确,你是这么说的吗?无论如何,由于我无法根据到目前为止提供的糟糕问题描述来帮助您,这里有一个链接可以提供新的见解:@BalusC请原谅我使用了上面的词语。当我说“无法创建所需的视图”时,我是说我仍然看不到创建的列。我试过了。但仍然没有生成任何列。
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">

    <ui:repeat items="#{row.hourArray}" var="item" varStatus="myVarStatus">
        <p:column styleClass="col-right col-90">
            <f:facet name="header">
                <h:outputText value="myVarStatus.index" escape="false" />
            </f:facet>
            <p:cellEditor>
                <f:facet name="output">
                    <h:outputText value="#{item}" escape="false">
                        <f:convertNumber maxFractionDigits="3" minFractionDigits="3"
                            maxIntegerDigits="5" />
                    </h:outputText>
                </f:facet>
                <f:facet name="input">
                    <p:inputText value="#{item}" maxlength="10" size="10">
                        <f:convertNumber maxFractionDigits="3" minFractionDigits="3"
                            maxIntegerDigits="5" />
                    </p:inputText>
                </f:facet>
            </p:cellEditor>
        </p:column>
    </ui:repeat>
</ui:composition>
private BigDecimal[] hourArray;