[Resolvido] Editar objeto com Dialog (Primefaces)

Olá Pessoa, boa tarde,

ressucitei o post porque estou com o mesmo problema e a solução dada aqui para mim não resolveu. As p:dialog simplesmente não são exibidas.

Não se assustem com a tristeza que é o código. Estou aprendendo essas tecnologias há 2 semanas. Tenham piedade.

Peço humildemente e encarecidamente aos experts de plantão, no dia do programador, para me ajudarem. Fico-lhes muitíssimo agradecido.

Trata-se de um pequeno sistema CRUD, com Hibernate, JSF 2, com Apache Tomcat 6 e JDK 1.6. Estas configurações não podem ser alteradas.

Seguem os códigos:

package controller;

import dao.ImovelDao;

import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;




import model.Imovel;

@ManagedBean @ViewScoped
public class ImovelBean implements Serializable {
	private ImovelDao imovelDao;
	private Imovel imovel = new Imovel();
	private DataModel<Imovel> imoveis;

	public void novo() {
		imovel = new Imovel();
	}

	public String inserir() {
		String resultado = "falha";
		imovelDao = new ImovelDao();
		boolean retorno = imovelDao.inserir(imovel);

		if (retorno) {
			resultado = "imoveis";
		}

		return resultado;
	}

	public void selecionar() {
		imovel = imoveis.getRowData();
	}

	public String alterar() {
		String resultado = "falha";
		imovelDao = new ImovelDao();
		boolean retorno = imovelDao.alterar(imovel);

		if (retorno) {
			resultado = "imoveis";
		}

		return resultado;
	}

	public String remover() {
		String resultado = "falha";
		imovelDao = new ImovelDao();
		boolean retorno = imovelDao.remover(imovel);

		if (retorno) {
			resultado = "imoveis";
		}

		return resultado;
	}

	public DataModel<Imovel> consultar() {
		imovelDao = new ImovelDao();
		List<Imovel> imovelList = imovelDao.listar();
		imoveis = new ListDataModel<Imovel>(imovelList);
		return imoveis;
	}
	
	public Imovel getImovel() {
		return imovel;
	}
	
	public void setImovel(Imovel imovel) {
		this.imovel = imovel;
	}

	public DataModel<Imovel> getImoveis() {
		imovelDao = new ImovelDao();
		List<Imovel> imovelList = imovelDao.listar();
		imoveis = new ListDataModel<Imovel>(imovelList);
		return imoveis;
	}

	public void setImoveis(DataModel<Imovel> imoveis) {
		this.imoveis = imoveis;
	}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Gerenciar Imóveis</title>
</h:head>
<h:body>
	<div align="center">
		<h:form id="formPrincipal">

			<p:dataTable id="tabelaImoveis" var="lista" value="#{imovelBean.imoveis}" 
				 selectionMode="single" selection="#{imovelBean.imovel}" 
				 rowKey="#{lista.matriculaImovel}" >
				 <p:ajax event="rowSelect" update=":formAlterar" />
				<f:facet name="header">Gerenciador de Imóveis</f:facet>
				<p:column headerText="Matrícula">
					<h:outputText value="#{lista.matriculaImovel}" />
				</p:column>
				<p:column headerText="Endereço">
					<h:outputText value="#{lista.enderecoImovel}" />
				</p:column>
				<p:column headerText="Valor do Imóvel">
					<h:outputText value="#{lista.valorImovel}">
						<f:convertNumber type="currency" locale="pt_BR" />
					</h:outputText>
				</p:column>
				<p:column headerText="Ações">
					<p:commandLink title="Alterar" update=":formAlterar:Alterar"
						oncomplete="dialogAlterar.show()" immediate="true">
						<p:graphicImage value="./imagens/editar.jpg" />
						<f:setPropertyActionListener target="#{imovelBean.imovel}"
							value="#{lista}" />
					</p:commandLink>
					<p:commandLink title="Excluir" update=":formExcluir:Excluir"
						oncomplete="confirmation.show()" immediate="true">
						<p:graphicImage value="./imagens/del.jpg" />
						<f:setPropertyActionListener target="#{imovelBean.imovel}"
							value="#{lista}" />
					</p:commandLink>
				</p:column>

			</p:dataTable>
			<p:commandButton value="Cadastrar" id="cadastrar"
				oncomplete="dialogCadastrar.show()" />
		</h:form>
	</div>
	<h:form id="formCadastrar">
		<p:dialog header="Novo Registro" widgetVar="dialogCadastrar" modal="true">
			<p:panelGrid id="panelCadastrar" columns="2">
				<h:outputText value="Matrícula" />
				<p:inputText value="#{imovelBean.imovel.matriculaImovel}" />
				<h:outputText value="Endereço:" />
				<p:inputText value="#{imovelBean.imovel.enderecoImovel}" />
				<h:outputText value="Valor:" />
				<p:inputText value="#{imovelBean.imovel.valorImovel}" />
			</p:panelGrid>
			<p:commandButton value="Cadastrar"
				actionListener="#{pessoaBean.cadastrar}"
				update=":formPrincipal:tabelaImoveis"
				oncomplete="dialogCadastrar.hide()" />
		</p:dialog>
	</h:form>
	<h:form id="formAlterar">
		<p:dialog header="Alterar Registro" widgetVar="dialogAlterar" modal="true" id="Alterar" dynamic="true">
			<p:panelGrid id="panelAlterar" columns="2">
				<h:outputText value="Matrícula" />
				<p:inputText value="#{imovelBean.imovel.matriculaImovel}" />
				<h:outputText value="Endereço:" />
				<p:inputText value="#{imovelBean.imovel.enderecoImovel}" />
				<h:outputText value="Valor:" />
				<p:inputText value="#{imovelBean.imovel.valorImovel}" />
			</p:panelGrid>
			<p:commandButton value="Alterar"
				actionListener="#{imovelBean.alterar}"
				update=":formPrincipal:tabelaImoveis"
				oncomplete="dialogAlterar.hide()" />
		</p:dialog>
	</h:form>
	<h:form id="formExcluir">
		<p:confirmDialog id="Excluir"
			message="Confirma exclusão do registro do imóvel de matrícula #{imovelBean.imovel.matriculaImovel}?"
			header="Excluir" severity="alert" widgetVar="confirmation">
			
			<p:commandButton id="confirm" value="Sim"
				oncomplete="confirmation.hide()"
				actionListener="#{imovelBean.excluir}"
				update=":formPrincipal:tabelaImoveis" />
			<p:commandButton id="decline" value="Não"
				onclick="confirmation.hide()" type="button" />
		</p:confirmDialog>
	</h:form>
</h:body>
</html>