Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
Java Primefaces中的过滤和分页_Java_Jsf_Primefaces - Fatal编程技术网

Java Primefaces中的过滤和分页

Java Primefaces中的过滤和分页,java,jsf,primefaces,Java,Jsf,Primefaces,我正在创建一个显示任务的数据表。我只想在每个页面中有8个任务,而且我想筛选由finished和not finished显示的任务 我已经实现了这两件事,它们都是分开工作的,但是当我加入它们时,会抛出一个异常: java.lang.IllegalStateException:CDATA标记不能嵌套 以下是数据表的代码: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/j

我正在创建一个显示任务的数据表。我只想在每个页面中有8个任务,而且我想筛选由finished和not finished显示的任务

我已经实现了这两件事,它们都是分开工作的,但是当我加入它们时,会抛出一个异常:

java.lang.IllegalStateException:CDATA标记不能嵌套

以下是数据表的代码:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    template="/templates/template-usuario.xhtml">
    <ui:define name="cuerpo">
        <h:form id="formTareas">
            <p:dataTable id="tablaTareas" var="tarea" value="#{controller.tasks}"
                border="1" selection="#{controller.selectedTasks}"
                widgetVar="tasksTable" rowKey="#{tarea.id}" rows="8"
                paginator="true">

                <p:column selectionMode="multiple"
                    style="width:16px;text-align:center" />
                <p:column>
                    <f:facet name="header">#{msgs.titulo}</f:facet>#{tarea.title}</p:column>
                <p:column>
                    <f:facet name="header">#{msgs.comentario}</f:facet>#{tarea.comments}</p:column>
                <p:column>
                    <f:facet name="header">#{msgs.fechaCreacion}</f:facet>#{tarea.created}</p:column>
                <p:column>
                    <f:facet name="header">#{msgs.fechaPlanificacion}</f:facet>#{tarea.planned}</p:column>


                <p:column filterBy="#{tarea.finished==null}"
                    headerText="#{msgs.fechaFinalizacion}" filterMatchMode="equals">
                    <f:facet name="filter">
                        <p:selectOneButton onchange="PF('tasksTable').filter()">
                            <f:converter converterId="javax.faces.Boolean" />
                            <f:selectItem itemLabel="All" itemValue="" />
                            <f:selectItem itemLabel="Not Finished" itemValue="true" />
                        </p:selectOneButton>
                    </f:facet>
                    <h:outputText value="#{tarea.finished}" />
                </p:column>


                <p:column>
                    <f:facet name="header">#{msgs.fechaFinalizacion}</f:facet>#{tarea.finished}</p:column>
                <p:column>
                    <f:facet name="header">#{msgs.categoria}</f:facet>#{tarea.categoryId}</p:column>
            </p:dataTable>
        </h:form>
    </ui:define>

</ui:composition>

#{msgs.titulo}{tarea.title}
#{msgs.comentario}{tarea.comments}
#{msgs.fechacreation}{tarea.created}
#{msgs.fechaplanificationacion}{tarea.planning}
#{msgs.fechaFinalizacion}{tarea.finished}
#{msgs.categoria}{tarea.categoryId}

我认为您的
过滤器by=“#{tarea.finished==null}”中有错误
尝试删除它,看看有什么问题happening@YagamiLight为了知道任务是否完成,我必须检查它的完成日期是否为空。然而,程序以正确的方式过滤任务。当我尝试在激活一个筛选器的情况下在表的不同页面之间进行更改时,问题出现了。问题是我从未看到过具有空值的筛选器这就是为什么我告诉您尝试删除并查看发生了什么,即使这是问题所在,我也会给出一个替代方案solution@YagamiLight在不检查finished(类型为date)的值是否为null的情况下,如何按terminated和not terminated筛选任务?您可以用not rensigned之类的字符值替换null值,请阅读示例