title: Close primefaces dialog and redirect main page
body: <p>In a submit handler of a button, I sometimes have to close my <code>p:dialog</code> and immediately perform of redirect of the main page. I have tried below code</p>
  
  <pre><code>RequestContext.getCurrentInstance().closeDialog(id);
  FacesContext.getCurrentInstance().getExternalContext()
          .redirect("../quote/select.xhtml?prospectid=" + id);
  </code></pre>
  
  <p>This is contained in submit(), called via a simple <code>commandButton</code>:</p>
  
  <pre><code>&lt;p:commandButton value="#{msg.common_save}" action="#{bean.submit}" /&gt;
  </code></pre>
  
  <p>Unfortunately, this does the redirect within the dialog, and does not close the dialog itself.
  Using only the first line does close my dialog, but then of course I still need to redirect my page.</p>
  
  <p>Is there any way to do what I'm looking for?</p>