Bom dia!
Seguinte to tentando mostrar uma mensagem de sucesso ou erro
num p:dialog apos executar um metodo, tenho o seguinte codigo na pagina:
<p:commandButton id="cmbSalvar" value="Salvar" update="dialog"
styleClass="botoes" oncomplete="dialog.show();"
action="#{ManegedBean.gravar()}">
<f:setPropertyActionListener value="#{true}" target="#{ManegedBean.meuMettodo}" />
</p:commandButton>
<<p:dialog header="Aviso" widgetVar="dialog" position="500,100" closeListener="#{ManegedBean.handleClose}"
closable="false" width="500" resizable="false">
<div align="center">
<h:panelGrid style="font-size:12px;">
<h:outputText value="#{ManegedBean.msgIncluidaSucesso}" />
<p:commandLink onclick="dialog.hide();">
<p:graphicImage value="/template/img/icones/ok.png" style="border: 0;" />
</p:commandLink>
</h:panelGrid>
</div>
</p:dialog>
esse é o metodo no ManegedBean
public String gravar() {
try {
fazAlgo();
this.msgIncluidaSucesso = "Incluído com sucesso.";
}
} catch (Exception e) {
e.printStackTrace();
this.msgIncluidaSucesso = "Não pode ser incluído.";
}
return null;
}
se alguem puder ajudar!!