Foros de discusión

Faces Messages Not Surviving Redirect

thumbnail
Jason Hodge, modificado hace 7 años.

Faces Messages Not Surviving Redirect

New Member Mensaje: 1 Fecha de incorporación: 3/02/14 Mensajes recientes
I am using Liferay 6.2 sp16 and JSF 2.2 with PrimeFaces 5.x.

After a successful operation, I am creating a message in my Controller:

FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, formattedSuccessMessage, null));

I am then returning a redirect directive on top of a default navigation case:

"manage-staff-roles?faces-redirect=true";

Where a page exists called "manage-staff-roles.xhtml".

The redirect succeeds, but the messages are then missing. <h:messages /> or <p:messages /> are empty (tried both).

I have tried putting in every combination of these two lines:

FacesContext.getCurrentInstance().getExternalContext().getFlash().setRedirect(true);
FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);

But the messages never come through. Throughout the rest of my application all the messages work. It just seems the redirect is causing messages to die, even if I tell them to live via the Flash.

I have also tried getting Flash to work as a single-request object hold-over mechanism, but it does not seem to work either.

What is the magic sauce to get this working?

Thanks,

Jason
thumbnail
Neil Griffin, modificado hace 7 años.

RE: Faces Messages Not Surviving Redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Hi Jason,

Thanks so much for posting this thread. I was able to reproduce the problem and created FACES-3019 in order to track the issue to closure. Please click on the "Watch" link in JIRA in order to be notified of updates.

Kind Regards,

Neil