How to display elements of a collection in JSP using Core Tag Library
843838Jul 21 2007 — edited Jul 23 2007I have a JSP where I am trying to display the elements of a collection. This collection is set as as Request Attribute in the action class. This collection contains the result of a database query done using Toplink. I am getting the collection as Not Null in the JSp but I am not able to display its contents using the following code. It just displays the balnk rows but I know the data is there in the collection when I debug it.
And when I try to display ${not empty cont} I get the value true on JSP. But the rows are displayed empty.
Can anybody pls guide me where I am going wrong:
(col1, col2....) are the column names which are returned by the query.
it is returned in some back end class as:
Collection contAll= (Collection) session.executeQuery(query);
and in the action class I set this returned value as the request attribute as:
request.setAttribute("cont", contAll);
</tr>
<c:forEach var="c" items="${cont.rows}">
<tr class="rowdata">
<td>
<c:choose>
<c:when test="${not empty c.col1}">
<b><c:out value="${c.col1}"/></b>
</c:when>
<c:otherwise>
<font color="red">No Col1#</font>
</c:otherwise>
</c:choose>
<br>(<c:out value="${c.col2}"/>)
<br><c:out value="${c.col3}"/>
</td>
<td>
<c:out value="${c.col4}"/>
</td>
<td>
<c:out value="${c.col5}"/>
</td>
<td>
<br>