title: Display a List of entities in JSF page
body: <p>I am trying to display a <code>List&lt;Student&gt;</code> using JSF.</p>
  
  <pre><code>public List&lt;Student&gt; retrieveStudent()
  {
  Sdao sdao=new Sdao();
  List&lt;Student&gt; stud=new ArrayList();
  List sname1=new ArrayList();
  List sdept1=new ArrayList();
  for(Student show1:sdao.retrieveStudent())
  {
  
      sname1.add(show1.getSname());
      sdept1.add(show1.getSdept());
  
  }
  stud.addAll(sname1);
  stud.addAll(sdept1);
  
  
  return stud;
  
  }
  </code></pre>
  
  <p>JSF Page:</p>
  
  <pre><code>    &lt;h:form&gt;
  
          &lt;h:outputText value="#{student.retrieveStudent()}"/&gt;
       &lt;/h:form&gt; 
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[Alpha,Beta,Science,Electronics]
  </code></pre>
  
  <p>I want to print it in a table with column name Names(Alpha, Beta) and column 2 their departments..i am not sure how to separate them and print...can anyone help me...</p>