I have a list of object objects that is being iterated in my xthml There, for each iteration, I create a panel and in each panel I display the name of each of the properties in the list and a button that calls a method loadPredio in the Bean. This method only loads the bean's farm attribute with the received argument. After that, a dialog is opened and the information of the property clicked is displayed. Item names are rendered perfectly on the screen. However, when the dialog opens, the fields are blank. Can anyone imagine what it is? Here is the code:
<c:forEach items="#{predioBean.listaPredios}" var="entry">
<h:panelGroup>
<h:outputText value="#{entry.nome}" />
<p:commandButton actionListener="#{predioBean.carregaPredio(entry)}" oncomplete="PF('DetalhesPredioDialog').show();"/>
</h:panelGroup>
</c:forEach>
<!-- ********** DIALOG DETALHES PREDIO ********** -->
<p:dialog header="#{predioBean.predio.nome}" widgetVar="DetalhesPredioDialog" modal="false" resizable="false" width="400" height="150" >
<h:panelGrid id="pnlDetalhesPredioDialog" style="margin-bottom:10px;" columns="2">
<h:outputLabel value="#{msg['nome']}" />
<p:inputText size="30" id="nomePredio" value ="#{predioBean.predio.nome}" />
<h:outputLabel value="#{msg['descricao']}" />
<p:inputText size="30" id="descricaoPredio" value ="#{predioBean.predio.descricao}"/>
<h:outputLabel value="#{msg['endereco']}" />
<p:inputText size="30" id="enderecoBanco" value ="#{predioBean.predio.endereco}" />
</h:panelGrid>
<h:panelGrid>
<p:commandButton value="#{msg['edita']}" icon="ui-icon-pencil" action="#{predioBean.editaPredio}"/>
</h:panelGrid>
</p:dialog>
Now the Bean:
@ManagedBean
@SessionScoped
public class PredioBean {
private Predio predio;
private List<Predio> listaPredios;
private PredioDAO predioDao;
@PostConstruct
public void initialize() {
this.predio = new Predio();
this.predioDao = new PredioDAO();
this.listaPredios = contaErrosDoPredio();
}
public void carregaPredio(Predio predio) {
this.predio = predio;
}
}
Thank you