I have a JSF page (using MyFaces 2.0) that collects data on the first display. If he cannot find any information, he must provide a message about this and redirect back to another page. I tried using the solution found Saving FacesMessage after redirection for presentation via <h: message> in JSF (setKeepMessages (true)), but messages do not appear after redirection. The only difference that I can highlight is that I do not use the navigation rule, I call the redirect () call in the external context, because this does not happen in the normal action.
Relevant Code:
public void redirectToPageWithMessage(String inPage, String message, FacesMessage.Severity severity){ getFlash().setKeepMessages(true); addMessage(message, severity); try { getFacesContext().getExternalContext().redirect(inPage); } catch (IOException e) { e.printStackTrace(); } }
Unfortunately this does not work. The forwarding happens just fine, but <messages / "> doesn't display a message. Is there anything else in the way the () redirection happens that prevents it from working?
source share