title: Removing JSF messages from the flash
body: <p>I have one page that does something and when the user clicks a button, the user is redirected to another page and a message is displayed. Here is my code:</p>
  
  <pre><code> public String confirm() {
      FacesContext context = FacesContext.getCurrentInstance();
      Flash flash = context.getExternalContext().getFlash();
      flash.setKeepMessages(true);
      FacesMessage msg = new FacesMessage("Succesful", "Release is confirmed!");
      context.addMessage(null, msg);
      return "/prot/expert/releases?faces-redirect=true";
   }
  </code></pre>
  
  <p>I use a p:growl component which displays my message on the "releases" page. So far so good.</p>
  
  <p>But then on any subsequent page that has p:growl (or if I go to another page and go back) the message is displayed again and again and I can't kill it.</p>
  
  <p>I tried something like:</p>
  
  <pre><code>&lt;c:set target="#{flash}" property="keepMessages" value="false" /&gt;
  </code></pre>
  
  <p>on the page that has the p:growl, I tried clearing the flash from the backing bean etc. </p>
  
  <p>The message is retained and displayed all over again. If I remove flash.setKeepMessages(true); from the code above then nothing is displayed.</p>
  
  <p>What am I doing wrong?</p>