I'm trying to print out an entire database table from a java class onto a JSP page. I have the means to print the string I want, but I don't know where to go from there. I'm using struts2 if that makes a difference.
<s:property value="stringIWantToMakeIntoAnHTMLTable" />
Suppose your table is for students list, create a bean class for student that have the fields in database. Then in Java page
List li=new ArrayList()
while(resultset.next())
{
//Read value from database
Student s=new Student(fields in beanclass);
li.add(s)
}
enter code here }
Keep that list in request/session attribute. In Jsp, use
<s:iterator>
tag of Struts2 to read values.