Assume I implement MVC model, there is List object which contains data from database where I get by using JPA in session bean and pass to servlet. The List object then pass to jsp from servlet. Since I need to display it in table in JSP by using JSTL, there is a lot of 40++ columns in database.
How should I display it by calling the columns index instead of columns name so that I can loop it rather than typing the column name out? My basic idea is:
<table>
<tr>
    <c:forEach var="i" begin="1" end="49" items="${listObject}">
       <td>${//here to loop listObject column name by index}</td>
    </c:forEach>
</tr>
<c:/forEach item="${listObject}"  var="a">
 <tr>
    <c:forEach var="i" begin="1" end="49">
    <td>${//here to loop listObject data by column index}</td>
    </c:forEach>
</tr>
</c:forEach>
</table>
So that the output would be like:
stu ID   | First Name | Last Name | Attendance Week 1| ...... | Attendance Week 46
-----------------------------------------------------------------------------------
         |            |           |                  |        |
         |            |           |                  |        |
         |            |           |                  |        |
         |            |           |                  |        |
It is impossible for me to type from column 1 to column 40++, so I would like to use looping, anyone can help?
 
     
    