title: Passing a FacesMessage to the next page
body: <p>I am looking for a graceful JSF way to do this and was wondering if there was any commonly accepted practice for doing this.</p>
  
  <p>When I navigate from one page to another, I want the new page to show a FacesMessage in a <strong>h:message</strong> component (actually <strong>p:message</strong> but it should be the same thing) that was transmitted from the last page.  </p>
  
  <p>So for example, if a user clicks a "Create Document" button it navigates to a new page on success, and shows the success message on the new page.  I want all my data-base changing operations to behave that way.</p>
  
  <p>It seems that the <strong>FacesContext</strong> clears all messages on the navigation, so my closest solution looks like this:</p>
  
  <ol>
  <li>Store the FacesMessage object in the session bean.</li>
  <li>Create a method <strong>checkMessage</strong> in the message bean that calls <strong>FacesContext.getCurrentInstance().addMessage(..)</strong> and removes the message from the message bean.</li>
  <li>Put a EL reference to <strong>checkMessage</strong> in the destination page.</li>
  <li>Put a <strong>p:message</strong> in the destination page.  </li>
  </ol>
  
  <p>This seems a bit forced -- is there a better way of doing this?</p>