Scenario:
I have a method gerRow() in a class DatabaseDAO that fetches some table rows and adds them in an object of class Row.
Each Row object is added to an ArrayList. The getRow() method returns that ArrayList.
Question:
My question is how do I iterate the text results in a JSP? I am planning to use the JSTL tags <c:out>
and <c:ForEach>
. I think that's the only option. How exactly can I do that?
Difficulty arisen by:
the method that I call returns an ArrayList. The ArraList has object of rows. I then have to separate each column in that row to print it out.
The Row object is of Row class, which has Row.getColum1, Row.getColum2, Row.getColum3 and so on.
Sample:
<jsp:useBean id="xxxxxxxxxxxx" class="xxxxxxxxxxxx" scope="request" />
<c:forEach var="xxxxxxxxxxxx" items="${xxxxxxxxxxxx}">
<c:out value="${xxxxxxxxxxxx.xxxxxxxxxxxx}" />
<c:out value="${xxxxxxxxxxxx.xxxxxxxxxxxx}" />
</c:forEach>