I am trying to display a List<Student>
using JSF.
public List<Student> retrieveStudent()
{
Sdao sdao=new Sdao();
List<Student> 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;
}
JSF Page:
<h:form>
<h:outputText value="#{student.retrieveStudent()}"/>
</h:form>
Output:
[Alpha,Beta,Science,Electronics]
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...