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

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 primefaces数据表中的空指针_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf primefaces数据表中的空指针

Jsf primefaces数据表中的空指针,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我有一个p:dataTable,当我尝试获取它时,所选值抛出空指针,这种情况是在将dataTable放入模式p:对话框之后发生的,但是如果移除模式atribute工作正常。 PD:模式p:对话框应该像这个问题一样覆盖 答案不适用于我,因为我使用的是primefaces 5.1,所以我必须使用appendTo=“@(body)” 我不知道这对我的问题是否重要 Resume:如果p:对话框是模态的,则存在空指针 这是我的密码 <!DOCTYPE HTML PUBLIC "-//W3C//DT

我有一个p:dataTable,当我尝试获取它时,所选值抛出空指针,这种情况是在将dataTable放入模式p:对话框之后发生的,但是如果移除模式atribute工作正常。 PD:模式p:对话框应该像这个问题一样覆盖

答案不适用于我,因为我使用的是primefaces 5.1,所以我必须使用appendTo=“@(body)”

我不知道这对我的问题是否重要

Resume:如果p:对话框是模态的,则存在空指针

这是我的密码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd">
<ui:composition template="/resources/sysged.xhtml"
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"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">


<ui:define name="vDoc">
    <h:form id="form">
        <p:panel header="Document">


            <h:panelGrid columns="4">
                <p:commandButton id="prev"
                    actionListener="#{DocumentController.priviousPage()}"
                    icon="ui-icon-circle-triangle-w" update="docImage next prev"
                    disabled="#{DocumentController.inicioLista}" />
                <p:commandButton id="next"
                    actionListener="#{DocumentController.nextPage()}"
                    icon="ui-icon-circle-triangle-e" update="docImage prev next"
                    disabled="#{DocumentController.finalLista}" />

                <p:commandButton id="anotacoes" value="Anotaçoes"
                    onclick="PF('dialogAnotacao').show();" />
                <p:button id="voltar" outcome="pesquisaDocumento.xhtml"
                    value="Voltar" />


            </h:panelGrid>

        </p:panel>



    </h:form>

    <h:form id="panotation">

        <p:dialog id="dialogAnotacao" closeOnEscape="true" header="Anotaçoes"
            widgetVar="dialogAnotacao" modal="true" resizable="false"
            appendTo="@(body)" draggable="true">


            <p:dataTable id="tanotation" var="anotation"
                value="#{DocumentController.arquivo.anotacaoList}"
                selectionMode="single"
                selection="#{DocumentController.selected}"
                rowKey="#{anotation.i}">



                <p:column headerText="Indice" style="text-align:left">
                    <h:outputText value="#{anotation.i}" />
                </p:column>
                <p:column headerText="text" style="text-align:left">
                    <h:outputText value="#{anotation.text}" />
                </p:column>

            </p:dataTable>

            <p:contextMenu for="tanotation">
                <p:menuitem value="do" update="tanotation"
                    icon="ui-icon-close" actionListener="#{DocumentController.doit}">
                </p:menuitem>
            </p:contextMenu>


        </p:dialog>

    </h:form>

</ui:define>
</ui:composition>
您将
附加到html页面的主体(请参见appendTo属性),因此它不包含在任何

这可能是您的


你能把你的
放在你的
里面而不是外面吗?

非常感谢,我刚刚改变了表格的位置,开始工作了
public void doit() {

    System.out.println(selected);

}