title: JSF/Primefaces - CommandButton: open new browser tab without ViewScoped bean getting killed
body: <p>I'm trying to open a new browser tab with a JSF view (in a portlet, deployed in Liferay) from within a view backed by a <code>ViewScoped</code> bean. Using a normal action redirect kills the bean.
  I've tried the method provided <a href="https://stackoverflow.com/questions/13836288/jsf-commandbutton-open-new-tab-with-flashscope-parameters/13838907#13838907">here</a> and <a href="https://stackoverflow.com/questions/13842036/java-ee-jsf-2-0-viewscoped-bean-after-redirect-to-new-window-npe">here</a>, but unfortunately without success.</p>
  
  <p>The button looks more or less like this:</p>
  
  <pre><code>&lt;p:commandButton value="#{msg.label}" onclick="target='_blank'" 
                   action="#{sessionScopedBean.action(param)}" ajax="false" /&gt;
  </code></pre>
  
  <p>Moving the <code>target='_blank'</code> to the form attribute did not help. I've tried both returning <code>null</code> and <code>void</code> with no success. Changing ajax to <code>true</code> broke the navigation, didn't open a new tab but also did not kill the <code>ViewScoped</code> bean.</p>
  
  <p>The <code>action</code> method content looks like this:</p>
  
  <pre><code>public void action(String param) throws IOException {
     //some business logic
  
     FacesContext.getCurrentInstance().getExternalContext().redirect("viewName.xhtml");
  }
  </code></pre>
  
  <p>The view does not contain tag handlers like <code>&lt;c:if test="..."&gt;</code> or <code>&lt;ui:include src="..."&gt;</code>. It did contain a <code>&lt;ui:repeat id="..." value="#{viewScopedBean.collection}" 
  var="..." varStatus="..."&gt;</code> tag, but removing it changed noting.
  The form is enclosed in <code>&lt;ui:composition&gt;</code> and <code>&lt;ui:define&gt;</code> tags.</p>
  
  <p>The view I redirect to has no connection with the ViewScoped bean. Any ideas? :)</p>