title: JSF 2.0: how to save the view after redirect (target=blank)
body: <p>Imagine I have the jsf form and the button to print report on form data. The button needs to open the data on the new page (<strong>target=blank</strong>), but <strong>h:button</strong> doesn't suit as I need to save the data just before the report page open. So, I use <strong>h:commandButton</strong> which makes the save action, and then redirects to the report page:</p>
  
  <pre><code>&lt;h:commandLink styleClass="reportButton" action="#{polisBean.doReportPrint}"
                      target="_blank" id="reportListLink"&gt;
                      Print report
                  &lt;/h:commandLink&gt;
  
  @ViewScoped
  @Named
  public class PolisBean
    ...
    public Object doReportPrint() {        
      if (canEdit() &amp;&amp; this.submit() == null) {
          return null;
      }
  
      return "printReport";
  }
  &lt;navigation-case&gt;
          &lt;from-outcome&gt;printReport&lt;/from-outcome&gt;
          &lt;to-view-id&gt;/polises/reportList.xhtml&lt;/to-view-id&gt;
          &lt;redirect include-view-params="true"&gt;
              &lt;view-param&gt;
                  &lt;name&gt;id&lt;/name&gt;
                  &lt;value&gt;#{polis.id}&lt;/value&gt;
              &lt;/view-param&gt;
          &lt;/redirect&gt;
      &lt;/navigation-case&gt;
  </code></pre>
  
  <p>The entity is saved perfectly and the new page is open with the report. Good. But when I go back to the initial form page and try to save again - the view is expired and built by new (as this is not a postback request, this is a totally new request for JSF, because I just made the redirect from this page!). Although the redirect was done while opening second page, this doesn't prevent from loosing all view scoped bean data..</p>
  
  <p>I tried the long-running <strong>conversationScope</strong> from CDI, but it throws the "ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped" exception when I turn back to the initial page...</p>
  
  <p>Has anyone solved the problem? How can I do the form submit with the redirect (to new page) but not loose the initial data?</p>