0

In JSF2(v2.3.0-m09), is there any way to keep messages after redirecting page with different path?

For Example,

while in /a/currentPage.xhtml, I'am adding a message and then redirect a page which is in different path like below:

FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("sample mesage");
FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().getFlash().setKeepMessages(true);
context.addMessage(null, message);

context.getExternalContext().redirect("/anotherPage.xhtml?faces-redirect=true");

In this case, I cannot see the message after located /anotherPage.xhtml.

Is there a way to do this?

NOTE: /anotherPage.xhtml includes messages tag as;

<h:messages globalsOnly="true" />
  • On the right of this question is a 'Related' block. There is a '6' upvoted Q/A called 'Preserving JSF messages after a redirect'. Why is that Q/A not helping you – Kukeltje Jan 12 '17 at 10:09
  • Possible duplicate of [Preserving JSF messages after a redirect](http://stackoverflow.com/questions/7503113/preserving-jsf-messages-after-a-redirect) – Esteban Rincon Jan 12 '17 at 15:29

0 Answers0