title: Passing value from data table to bean JSF with Confirm Dialog
body: <p>I'm having trouble with passing a single value from the data table to the backing bean. I always get the value of 0 when I try to print it in the method in the confirm dialog but when I try to print it in the method in the command button, it shows the value that I need. I think it resets the value or whatever.</p>
  
  <pre><code>&lt;p:dataTable id="labLists" var="lab" value="#{coltsysHome.laboratory}" &gt;
    .....
    &lt;p:column headerText=" "&gt;
          &lt;p:commandButton value="DELETE" onclick="confDlg.show()" icon="ui-icon-closethick" action="#{coltsysHome.action}"&gt;
                  &lt;f:setPropertyActionListener value="#{lab.lab_id}" target="#{coltsysHome.lab_id_del}" /&gt;
           &lt;/p:commandButton&gt;
     &lt;/p:column&gt;   
  </code></pre>
  
  <p>For the confirm dialog:</p>
  
  <pre><code>&lt;p:confirmDialog widgetVar="confDlg" header="DELETE LABORATORY" message="Are you sure you want to delete this lab?"&gt;
     &lt;h:form id="delDlgForm"&gt;
             &lt;p:commandButton id="confirm" value="Yes Sure" oncomplete="confDlg.hide()" actionListener="#{coltsysHome.deleteLab(event)}"/&gt; 
              &lt;p:commandButton id="decline" value="Not Yet" onclick="confDlg.hide()" type="button" /&gt; 
  
      &lt;/h:form&gt;
  </code></pre>
  
  <p></p>
  
  <p>Bean (RequestScoped):</p>
  
  <pre><code>...getter and setter (lab_id_del)
  
  public void deleteLab(ActionEvent event) {
  
      FacesContext context = FacesContext.getCurrentInstance();
      String cpath = context.getExternalContext().getRequestContextPath();
  
      try (Connection conn = dataSource.getConnection()) {
          ColtsysDAO coltsysDAO = new ColtsysDAO(conn);
          coltsysDAO.deleteLab(lab_id_del, coltsysDAO.getUserID(getUser_name()));
  
      } catch (Exception e) {
          e.printStackTrace(System.err);
      }
  }
  public void action() {
      System.out.println("lab_id_del: " + lab_id_del);
  }
  </code></pre>