【问题标题】:Primefaces p:diaolg component not workingPrimefaces p:diaolg组件不工作
【发布时间】:2013-08-04 15:43:20
【问题描述】:

我在创建 index.xhtml 时遇到了这个错误。我正在使用 primefaces 3.4 在我的页面索引中,我将显示一个区域列表,当我单击添加按钮时,应该会出现一个对话框窗口。错误是: “javax.faces.FacesException:找不到从“j_idt10”引用的标识符为“nZone”的组件。”

  <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

     <h:head>
        <title>Listes des zones</title>
        <link type="text/css" rel="stylesheet" href="dot-luv/theme.css"/>
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit position="left"  header="Atividades" resizable="true" closable="true" collapsible="true">
                <h:form prependId="false">
                    <p:commandLink value="Nouvelle Zone" actionListener="#{ZoneController.preparAddZone()}" update="nZone" oncomplete="dialogGerLivro.show()"/>
                </h:form>
                <h:outputLink value="#{facesContext.externalContext.requestContextPath}/j_spring_security_logout">
                    <h:outputText value="Sair"/>
                </h:outputLink>
            </p:layoutUnit>
            <p:layoutUnit position="center">
                <h1>Listes des zones</h1><br/>
                <br/><br/>
                <h:form prependId="false">
                    <p:dataTable id="table" var="zone" value="#{ZoneController.listZones}">
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Zone"/>
                            </f:facet>
                            <h:outputText value="#{zone.nomzone}" />
                        </p:column>
                            <f:facet name="header">
                                <h:outputText value="Modifier"/>
                            </f:facet>
                        <p:commandButton actionListener="#{ZoneController.preparEditZone()}" value="Modifier" update="nZone" oncomplete="dialogGerLivro.show()"/>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Supprimer"/>
                            </f:facet>
                            <h:commandLink action="#{ZoneController.DeleteZone}" value="Supprimer"/>
                        </p:column>
                    </p:dataTable>
                </h:form>
            </p:layoutUnit>
        </p:layout>

        <p:dialog header="Ajouter Zone" widgetVar="dialogGerLivro"  resizable="false" modal="true" showEffect="slide" width="500">
            <h:form prependId="false">
                <h:panelGrid id="nZone" columns="2" style="margin-bottom:10px">

                    <h:outputLabel for="titulo" value="Título:" />
                    <h:inputText id="titulo" value="#{ZoneController.zone.nomzone}"/>

                    <p:commandButton update="tabele" oncomplete="dialogGerLivro.hide();" actionListener="#{ZoneController.SaveZone}" value="Insérer Zone"/>
                    <p:commandButton update="tabele" oncomplete="dialogGerLivro.hide();" actionListener="#{ZoneController.UpdateZone}" value="Modifier Zone"/>

                </h:panelGrid>
            </h:form>
        </p:dialog>
    </h:body>
</ht

【问题讨论】:

    标签: primefaces


    【解决方案1】:
    <h:panelGrid id="nZone" columns="2" style="margin-bottom:10px">
    

    h:form 内,这是另一个NamingContainer,您在其中

    <p:commandLink value="Nouvelle Zone" actionListener="#{ZoneController.preparAddZone()}" update="nZone" oncomplete="dialogGerLivro.show()"/>
    

    <p:commandButton actionListener="#{ZoneController.preparEditZone()}" value="Modifier" update="nZone" oncomplete="dialogGerLivro.show()"/>
    

    尝试使用update=":nZone" 引用它。有关详细信息,请参阅另一个问题的链接。

    【讨论】:

    • 我确实像你说的那样,现在我得到了这个异常:java.lang.IllegalArgumentException: :nZone
    • 尝试命名包含 nZone 对象的表单,并像这样引用该对象::formName:nZone
    • IllegalArgumentException?在定义update=":nZone:"的组件上?这个例外对我来说听起来很奇怪,我不确定它是从那里来的
    猜你喜欢
    • 2013-05-30
    • 1970-01-01
    • 2018-02-04
    • 2015-05-15
    • 1970-01-01
    • 1970-01-01
    • 2014-05-15
    • 1970-01-01
    相关资源
    最近更新 更多