0 Replies Latest reply on Aug 2, 2012 7:32 PM by iapazmino

    Messages lost after redirect

    iapazmino

      Hello,

       

      I've a JSF page which redirects to another after acting on some data and adds a message to notify results. This page relies on a javax.enterprise.context.RequestScoped backing bean which is setting the message, but it soesn't make it to the redirected page. If I click the back button in the browser and refresh the page, the message appears.

       

      The action in the page is invoked by a button

       

      <h:commandButton value="Register" action="#{registration.register}" />
      

       

      and the action method sets the outcome and ask the flash scope to keep the messages

       

      public String register() {
        ...
        getFacesContext().addMessage(null, message);
        getFlash().setKeepMessages(true);
        return "/admin/dashboard?faces-redirect=true";
      }
      

      and the target page just expects to print the messages

       

      <h:messages globalOnly="true" />
      

       

      I believe this should work. I'm using JBoss AS 7.1.2 with default JSF implementation Mojarra 2.1.7

       

      Am I missing something to make this work?

       

      Thanks in advance