title: Primefaces call ConfirmDialog from Backing
body: <p>I would like to call <code>confirmDialog</code> via backing. This code works perfectly, but how can I set the message and set the actionlistener of the confirmDialog via backing? There is two condition, while:</p>
  
  <ul>
  <li><em>The user check the option A on the checkbox (I omitted the code), then it should be directly print a text to console.</em> --> This one is done by the code below</li>
  <li>The user check the option B on the checkbox, then it should be show the confirmDialog and while the user press YES button, it should be call another function on the backing. </li>
  </ul>
  
  <p>How to do that? Thanks.</p>
  
  <pre><code>&lt;p:commandButton value="Execute" icon="ui-icon-circle-check"  update="frmContent" actionListener="#{backing.validate}" /&gt;
  
  &lt;p:confirmDialog id="cfmDlg" widgetVar="wvCfmDlg" global="true" &gt;
      &lt;p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" /&gt;
      &lt;p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" /&gt;
  &lt;/p:confirmDialog&gt;
  </code></pre>
  
  <p>In Backing:</p>
  
  <pre><code>public void validate() {
      if(mode.equals("1")) {
          System.out.println("OK");
      } else {
          //call confirmDialog and set message + action listener
          RequestContext context = RequestContext.getCurrentInstance();
          context.execute("wvCfmDlg.show();");
      }
  }
  </code></pre>