title: Can not get data table row selection in PrimeFaces, jsf?
body: <p>I'm working on a project. I need to get a list from MySql database and list it. I'm using JSF 2.1 Primeface 3.5 and Eclipse Juno. I run my code but it doesn't work. You can see my codes in below </p>
  
  <pre><code>     //LOGIN CLASS
  
      import parts
      @ManagedBean
      @SessionScoped
      public class Login {
  
  private String username, password;
  private PreparedStatement ps, ps2;
  private ResultSet rs, rs2;
  private List&lt;Application&gt; applications = new ArrayList&lt;Application&gt;();;
  private Application selectedApplication;
  
  // GETTERS SETTERS
  
  
  
  public String login() {
      Connection object = new Connection();
  
      try {
  
          ps = nesne
                  .getCon()
                  .prepareStatement(
                          "select Username, Password from company where Username=? and Password=?");
          ps.setString(1, getUsername());
          ps.setString(2, getPassword());
          rs = ps.executeQuery();
  
          while (rs.next()) {
  
              getList();
              return "application";
  
          }
  
      } catch (Exception e) {
          System.err.println(e);
  
      }
  
  
      return "confirm";
  }
  
  
  private List&lt;Application&gt; getList() {
      Baglanti nesne = new Baglanti();
      try {
  
          ps2 = nesne
                  .getCon()
                  .prepareStatement(
                          "select ApplicationName from application where CompanyID=(select ID from company "
                                  + "where Username=? and Password=?)");
  
          ps2.setString(1, getUsername());
          ps2.setString(2, getPassword());
          rs2 = ps2.executeQuery();
  
  
          while (rs2.next()) {
              Application obj = new Application();
              obj.setApplicationName(rs2.getString("ApplicationName"));
              applications.add(obj);
  
          }
  
      } catch (Exception e) {
          System.err.println(e);
  
      }
      return applications;
  }
  </code></pre>
  
  <p>APPLICATION CLASS</p>
  
  <pre><code>import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  @ManagedBean
  @SessionScoped
  public class Application {
  
  private int ID;
  private int CompanyID;
  private String Type;
  private Date Date;
  private String ApplicationName;
  private int CurrentMessageCount;
  private int MaxMessage;
  private String isPro;
  
  
      //GETTERS SETTERS
  </code></pre>
  
  <p>application.xhtml</p>
  
  <pre><code>   &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
     &lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui"&gt;
     &lt;h:head&gt;
      &lt;title&gt;Login Confirmed&lt;/title&gt;
     &lt;/h:head&gt;
     &lt;h:body&gt;
      &lt;h1 class="ui-widget-header ui-corner-all" align="center"&gt;Application
      List&lt;/h1&gt;
  &lt;br /&gt;
  &lt;h:form id="form"&gt;
  
      &lt;p:growl id="msgs" showDetail="true" /&gt;
  
      &lt;p:dataTable id="applications" var="application"
          value="#{login.applications}"&gt;
  
          &lt;p:column headerText="Application" style="width:24%"&gt;
              &lt;h:outputText value="#{login.applications}" /&gt;
          &lt;/p:column&gt;
  
          &lt;p:column style="width:4%"&gt;
              &lt;p:commandButton id="selectButton" icon="ui-icon-search"
                  title="View"&gt;
                  &lt;f:setPropertyActionListener value="#{application}"
                      target="#{login.selectedApplication}" /&gt;
              &lt;/p:commandButton&gt;
          &lt;/p:column&gt;
  
      &lt;/p:dataTable&gt;
  
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>I can login properly after that ı saw this page.
  <img src="https://i.stack.imgur.com/jbHrv.png" alt="enter image description here">
   Now where is my mistake?</p>