Foren
Faces Messages Not Surviving Redirect
Jason Hodge, geändert vor 7 Jahren.
Faces Messages Not Surviving Redirect
New Member Beitrag: 1 Beitrittsdatum: 03.02.14 Neueste Beiträge
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
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
Neil Griffin, geändert vor 7 Jahren.
RE: Faces Messages Not Surviving Redirect
Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
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
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