Metodo que o botão alterar chama
public void carregarUmBairro() { logger.error(this.bairro.getDescricao() + " - Alterar"); try { FacesContext.getCurrentInstance().getExternalContext().redirect("bairro_cadastrar_alterar.xhtml"); } catch (IOException e) { logger.error(e.getMessage()); } }
Meu xhtml
<p:dataTable value="#{bairrocontroller.listaTodosBairros}" var="bairro" rows="10" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
<p:column headerText="País" sortBy="#{bairro.pais.descricao}" expandableRowGroups="true">
<h:outputText value="#{bairro.pais.descricao}" />
</p:column>
<p:column headerText="Estado" sortBy="#{bairro.estado.descricao}">
<h:outputText value="#{bairro.estado.descricao}" />
</p:column>
<p:column headerText="Município" sortBy="#{bairro.municipio.descricao}">
<h:outputText value="#{bairro.municipio.descricao}" />
</p:column>
<p:column headerText="Bairro" sortBy="#{bairro.descricao}">
<h:outputText value="#{bairro.descricao}" />
</p:column>
<p:column style="width:32px;text-align: center">
<p:commandButton ajax="true" oncomplete="PF('carDialog').show()" icon="fa fa-edit" title="View"
action="#{bairrocontroller.carregarUmBairro}">
<f:setPropertyActionListener value="#{bairro}" target="#{bairrocontroller.bairro}" />
</p:commandButton>
</p:column>
<p:column style="width:32px; text-align: center">
<p:commandButton title="Deletar bairro" icon="fa fa-trash"
action="#{bairrocontroller.removeBairro()}">
<f:setPropertyActionListener value="#{bairro}"
target="#{bairrocontroller.bairro}" />
<p:confirm header="Confirmação" message="Deseja apagar este registro ?" icon="ui-icon-alert" /></p:commandButton>
</p:column>
</p:dataTable>
Xhtml que é chamado
<h:form id="paisCadastrarAlterar">
<p:fieldset legend="Cadastrar / Alterar um bairro" style="margin-bottom:20px">
<p:growl id="msgs" showDetail="true" />
<h:panelGrid columns="1" cellpadding="5">
<p:outputLabel value="País:" for="paisBairro" />
<p:autoComplete id="paisBairro" placeholder="Descrição do país" forceSelection="true" value="#{bairrocontroller.paisTexto}" completeMethod="#{paiscontroller.completeText}" onkeyup="this.value = this.value.toUpperCase();" size="100" />
<p:outputLabel value="Estado:" for="estadoBairro" />
<p:autoComplete id="estadoBairro" placeholder="Descrição do estado" forceSelection="true" value="#{bairrocontroller.estadoTexto}" completeMethod="#{estadocontroller.completeText}" onkeyup="this.value = this.value.toUpperCase();" size="100" />
<p:outputLabel value="Município:" for="municipioBairro" />
<p:autoComplete id="municipioBairro" placeholder="Descrição do logradouro" forceSelection="true" value="#{bairrocontroller.municipioTexto}" completeMethod="#{municipiocontroller.completeText}" onkeyup="this.value = this.value.toUpperCase();" size="100" />
<p:outputLabel for="descricaoBairro" value="* Descrição:" />
<p:inputText value="#{bairrocontroller.bairro.descricao}" maxlength="255" onkeyup="this.value = this.value.toUpperCase();" id="descricaoBairro" size="100" placeholder="Descrição do bairro" />
</h:panelGrid>
<h:panelGrid columns="2" cellpadding="5">
<p:commandButton title="Salvar bairro" icon="fa fa-save" action="#{bairrocontroller.salvar()}" update="@form" process="@form" />
<p:commandButton title="Cancelar ação" icon="fa fa-mail-reply" action="#{bairrocontroller.cancelar()}" update="@form" process="@form" />
</h:panelGrid>
</p:fieldset>
</h:form>
Mas as informações não são mostradas. O que pode ser ?