留言板
Faces Messages Not Surviving Redirect
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,修改在7 年前。
RE: Faces Messages Not Surviving Redirect
Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
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