Preserving FaceMessage after redirect for presentation through <h:message> in JSF
I have what I suppose is a common problem: some managed bean has an action which adds some messages to the context:

    FacesMessage fm = new FacesMessage("didn't work");
    fm.setSeverity(FacesMessage.SEVERITY_ERROR);
    FacesContext.getCurrentInstance().addMessage(null, fm);
    return "some-outcome";

Then I map the outcome in `faces-config.xml` and configure it to 

    <navigation-case>
        <from-outcome>some-outcome</from-outcome>
        <to-view-id>/view.xhtml</to-view-id>
        <redirect/>
    </navigation-case>

In `view.xhtml` I present the message:

    <h:message globalsOnly="true" />

However, it does not work because the message is lost when the redirect is executed.

How would I solve it? I found this [amazing post](http://blog.kaiec.org/2009/03/01/message-handling-with-jsf-and-redirects/) explaining how to do it using a `PhaseListener` but I believe this situation is too common to have to be solved this way. Am I wrong? Should I create the `PhaseListener`? Or is there some other, standard solutions?

Thanks in advance!
Preserving FaceMessage after redirect for presentation through <h:message> in JSF
===

I have what I suppose is a common problem: some managed bean has an action which adds some messages to the context:

    FacesMessage fm = new FacesMessage("didn't work");
    fm.setSeverity(FacesMessage.SEVERITY_ERROR);
    FacesContext.getCurrentInstance().addMessage(null, fm);
    return "some-outcome";

Then I map the outcome in `faces-config.xml` and configure it to 

    <navigation-case>
        <from-outcome>some-outcome</from-outcome>
        <to-view-id>/view.xhtml</to-view-id>
        <redirect/>
    </navigation-case>

In `view.xhtml` I present the message:

    <h:message globalsOnly="true" />

However, it does not work because the message is lost when the redirect is executed.

How would I solve it? I found this [amazing post](http://blog.kaiec.org/2009/03/01/message-handling-with-jsf-and-redirects/) explaining how to do it using a `PhaseListener` but I believe this situation is too common to have to be solved this way. Am I wrong? Should I create the `PhaseListener`? Or is there some other, standard solutions?

Thanks in advance!