title: How can I get values out of a selectOneMenu inside a JSF datatable?
body: <p>I have a JSF datatable with a bunch of rows, with each row having a selectOneMenu inside of it like this:</p>
  
  <pre><code>    &lt;h:form 
        &lt;h:dataTable id="myTable"
          binding="#{myBean.dataTable}"
          value="#{myBean.dataTableRows}" var="row"
          first="0" rows="0" dir="LTR" frame="hsides" rules="all"&gt;
  
          &lt;h:column&gt;
            &lt;f:facet name="header"&gt;
              &lt;h:outputText value="Sample Name" /&gt;
            &lt;/f:facet&gt;
            &lt;h:outputText value="#{row.sampleName}" /&gt;
          &lt;/h:column&gt;
  
          &lt;h:column&gt;
            &lt;f:facet name="header"&gt;
              &lt;h:outputText value="Role" /&gt;
            &lt;/f:facet&gt;
            &lt;h:selectOneMenu value="#{row.role}"
              id="roleInput"&gt;
              &lt;f:selectItems value="#{myBean.allRoles}" /&gt;
            &lt;/h:selectOneMenu&gt;
          &lt;/h:column&gt;
  
        &lt;/h:dataTable&gt;
  
        &lt;h:commandButton value="Save" action="#{myBean.save}" /&gt;
      &lt;/h:form&gt;
  </code></pre>
  
  <p>However, I can't seem to figure out how get the selected role out of each row in the save method.   In other words, I want to save each row's value. I saw this article, which explains how to save an input text box:</p>
  
  <p><a href="http://balusc.blogspot.com/2006/06/using-datatables.html#EditableDatatable" rel="nofollow noreferrer">http://balusc.blogspot.com/2006/06/using-datatables.html#EditableDatatable</a></p>
  
  <p>but it doesn't seem to apply to the h:selectOneMenu case.  Does anyone have any example code that does this?</p>
  
  <p>Thanks!</p>