title: Understand Flash Scope in JSF2
body: <p>From what I understand , objects  placed inside the Flash scope in a faces request lifecycle will be available for the next  faces request lifecycle  and then clear.</p>
  
  <p>Suppose I have two pages:</p>
  
  <p><strong>page01.xhtml</strong>:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;h:commandButton  action="#{page01Bean.action}" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p><strong>Page01Bean :</strong></p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class Page01Bean {
  
          public void action(){
              FacesContext.getCurrentInstance().getExternalContext().getFlash().put("fooKey", "fooValue");
          }
  
  }
  </code></pre>
  
  <p><strong>page02.xhtml</strong>:</p>
  
  <pre><code>&lt;h:outputText value="#{flash.fooKey}"/&gt; 
  </code></pre>
  
  <p>So when the button in <code>page01.xhtml</code> is clicked , a faces request life-cycle (say life-cycle A) starts and set the value to the flash under the key called <code>fooKey</code></p>
  
  <p>Then I open another browser tab and browse  <code>page02.xhtml</code> . Another  faces request lifecycle  (say lifecycle B) starts to render this page . I expected that lifecycle B can access its previous lifecycle 's flash scope (i.e life-cycle A) and display <code>fooValue</code>in  <code>page02.xhtml</code>. However , it displays nothing.</p>
  
  <p>Please correct me what I misunderstand about the flash scope in this exmaple. Thanks so much</p>