I'm doing a job where I use Primefaces + Ajax + Hibernate. I have a screen to add / change a client that should open in a modal every time the user clicks the button. And in that same code I have a dataTable to show all clients. However, for some reason, every time the same error appears:
HTTP Status 500 - Cannot find component with expression "infosCliente" referenced from "j_idt9".
The same goes for dataTable. It looks like Primefaces does not "find" these components on the page. This is my view:
index.xhtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title>PrimeFaces</title>
</f:facet>
<link type="text/css" rel="stylesheet" href="dot-luv/skin.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="Novo Cliente" actionListener="#{clientes.prepararAdicionarClientes}" update="infosCliente" oncomplete="dialogGerCliente.show()"/>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h1>Gerenciador de Clientes</h1>
<br/>
<h:form prependId="false">
<p:dataTable id="tabela" var="cliente" value="#{clientes.listarClientes}">
<p:column>
<f:facet name="header">
<h:outputText value="Nome"/>
</f:facet>
<h:outputText value="#{cliente.nome}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Endereço"/>
</f:facet>
<h:outputText value="#{cliente.endereco}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Telefone"/>
</f:facet>
<h:outputText value="#{cliente.telefone}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Data de Nascimento"/>
</f:facet>
<h:outputText value="#{cliente.dtnascimento}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="E-mail"/>
</f:facet>
<h:outputText value="#{cliente.email}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Alterar"/>
</f:facet>
<p:commandButton actionListener="#{clientes.alterarClientes}" value="Alterar" update="infosCliente" oncomplete="dialogGerCliente.show()"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Excluir"/>
</f:facet>
<h:commandLink action="#{clientes.excluirCliente}" value="Excluir"/>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
<p:dialog header="Gerência de Clientes" widgetVar="dialogGerCliente" resizable="false" modal="true" showEffect="slide" width="500">
<h:form prependId="false">
<h:panelGrid id="infosCliente" columns="2" style="margin-bottom:10px">
<h:outputLabel for="nome" value="Nome:" />
<h:inputText id="nome" value="#{clientes.clientes.nome}"/>
<h:outputLabel for="endereco" value="Endereço:" />
<h:inputText id="endereco" value="#{clientes.clientes.endereco}"/>
<h:outputLabel for="telefone" value="Telefone:" />
<h:inputText id="telefone" value="#{clientes.clientes.telefone}"/>
<h:outputLabel for="dtnascimento" value="Data de Nascimento" />
<h:inputText id="dtnascimento" value="#{clientes.clientes.dtnascimento}"/>
<h:outputLabel for="email" value="E-mail:" />
<h:inputText id="email" value="#{clientes.clientes.email}"/>
<p:commandButton update="tabela" oncomplete="dialogGerCliente.hide();" actionListener="#{clientes.adicionarClientes}" value="Inserir Cliente"/>
<p:commandButton update="tabela" oncomplete="dialogGerCliente.hide();" actionListener="#{clientes.alterarClientes}" value="Alterar Cliente"/>
</h:panelGrid>
</h:form>
</p:dialog>
</h:body>
</f:view>
</html>
If I remove the customerClient and table (the ids), the page displays the table with all the registered clients and gives even to delete, however the change does not work and the button for the insert / change modal does not appear.