FacesMessage not displayed when redirect using prettyfaces

Splash Forums PrettyFaces Users FacesMessage not displayed when redirect using prettyfaces

This topic contains 4 replies, has 2 voices, and was last updated by  Christian Kaltepoth 11 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #17848


    Hi, I’m new on prettyfaces. Currently I have developed a website, http://www.adsafari.us, using Primefaces + Prettyfaces.

    The prettyfaces was added lately on simple URLs, however I get something weird regarding faces message. My faces message (using primefaces p:message) was not displayed when I redirect page from action method. When i use something like this (returns JSF 2 implicit navigation), the message was displayed correctly:

    public String doSomething() {

    FacesMessage facesMessage = new FacesMessage(….)

    FacesContext.getCurrentInstance().addMessage(null, facesMessage);

    return “/pages/member/home.jsf”;


    but when I change the return value into “pretty:member_home”, navigation was redirected to proper page, but no message displayed. I guess this is something related with faces-redirect, but i don’t know how to display the message.

    Here is the pretty-config.xml

    <url-mapping id=”member_home”>

    <pattern value=”/member/home” />



    Is there any way to correctly display message?

    Thank you


    Unfortunately this is expected behavior. As the redirect results in a completely new request which is independent of the original request that generated the messages, these won’t be rendered on the page.

    However there is a workaround for this issue. Lincoln wrote a PhaseListener that saves the messages in the session and restores them when the following request is received. To use this listener, just add the following lines to your faces-config.xml:


    I guess we should really mention this in the documentation. :-)



    i’ll try it at once, thanks

    but when you said “saves the messages in the session”, will that means that session size will be very large?


    No, the messages are saved just before the redirect is sent and then restored when the new request arrives. After that they will be immediately removed from the session. So they won’t increase the session size.

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.