title: Populate and show datatable on selection
body: <p>I want to populate and display datatable after user select a user from a selectmenu as below:</p>
  
  <pre><code>&lt;div align="center"&gt;
   &lt;h:selectOneMenu value="#{dtEditView.user}" &gt;
   &lt;f:selectItem itemLabel="FastWeb" itemValue="FastWeb"/&gt;
   &lt;f:selectItem itemLabel="george" itemValue="george"/&gt;
   &lt;/h:selectOneMenu&gt;&lt;p:spacer/&gt;
  &lt;p:commandButton value="Submit" action="#{dtEditView.enabletable()}" update="data"/&gt;
  &lt;p:outputPanel id="data"&gt;
                      &lt;p:dataTable id="users1" var="user" value="#{dtEditView.users1}" editable="true"  resizableColumns="true" style="margin-bottom:20px" widgetVar="usersTable" rendered="#{dtEditView.showtable}"&gt;
  &lt;p:column headerText="No" filterBy="#{user.no}" filterMatchMode="contains" sortBy="#{user.no}"&gt;
                          &lt;p:cellEditor&gt;
                              &lt;f:facet name="output"&gt;&lt;h:outputText value="#{user.no}" /&gt;&lt;/f:facet&gt;
                              &lt;f:facet name="input"&gt;&lt;p:inputText id="modelInput" value="#{user.no}" style="width:100%"/&gt;&lt;/f:facet&gt;
                          &lt;/p:cellEditor&gt;
                      &lt;/p:column&gt;
  
                      &lt;p:column headerText="A/C No" filterBy="#{user.USERID}" filterMatchMode="contains" sortBy="#{user.USERID}"&gt;
                          &lt;p:cellEditor&gt;
                              &lt;f:facet name="output"&gt;&lt;h:outputText value="#{user.USERID}" /&gt;&lt;/f:facet&gt;
                              &lt;f:facet name="input"&gt;&lt;p:inputText id="modelInput2" value="#{user.USERID}" style="width:100%"/&gt;&lt;/f:facet&gt;
                          &lt;/p:cellEditor&gt;
                      &lt;/p:column&gt; 
  &lt;/
  &lt;/p:dataTable&gt;
                      &lt;/p:outputPanel&gt;
  </code></pre>
  
  <p>My managed bean</p>
  
  <pre><code>@ManagedBean(name="dtEditView")
  @ViewScoped
  public class EditView implements Serializable {
  private List&lt;User&gt; users1;
  @ManagedProperty("#{quantumService}")
      private QuantumService service;
  @PostConstruct
      public void init() {
          try {
             users1 = service.createUsers(user);
  
          } catch (SQLException ex) {
              Logger.getLogger(EditView.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  
  
   public List&lt;User&gt; getUsers1() {
          return users1;
      }
  </code></pre>
  
  <p>The class is too big so am just giving part of the code to demonstrate what I have done so far. I am passing item selected to the method which queries users from database and creates a list which I in turn use to populate my datatable. </p>