hi im kind of new at jsf enviroment, im trying to update a primefaces growl and then redirect to a page from a commandButton action.
<p:commandButton value="Guardar" action="#{AgendamientoMBean.procesaAgendamientoJ()}"
update="growlDetalle" />
The managed bean code its
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, descripcion, detalle));
....
....
return "agp_bandeja_citas_llamadas?faces-redirect=true";
This only redirectme to the page but doesnt show me the growl message, i tested that if change my method to not return the page the message does show..
I was trying to update the growl of the page that im redirecting but thats impossible i guess.
i think that when redirecting i lost the update functionality because im in new page now.
Is there a way to tell jsf to first do the update and then redirecting?
Hope you can help me, thanks in advance
Messages get lost during redirect. You can use the flash to keep messages.
Add the following before returning from your action method:
FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().getFlash().setKeepMessages(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With