http://www.herongyang.com/jsp/jstl_core.html
JSTL more indepth:
http://www.ibm.com/developerworks/java/library/j-jstl0211.html
Empty lists in JSTL: [there is support for gt, eq, lt... too]
<c:if test="${empty myList}"%>
There is an EMPTY LIST!
</c:if%>
Sample code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.dkib.widgits.RecSummitOTCRecActiveRecord" %>
<c:set var="rows" value="<%=RecSummitOTCRecActiveRecord.getRecords()%>"/>
<head>
<body bgcolor="#FFFFFF">
<br/>
<table id='hor-zebra'>
<tr>
<th>Book</th>
<th>BreakCount</th>
<th>MatchCount</th>
<th>TradeCount</th>
<th>PercentMatch</th>
</tr>
<c:set var="oddEven" value="true" />
<c:forEach var="row" items="${rows}">
<c:choose>
<c:when test="${oddEven}">
<tr>
</c:when>
<c:otherwise>
<tr class="odd">
</c:otherwise>
</c:choose>
<td>${row.book}</td>
<td>${row.breakCount}</td>
<td>${row.matchCount}</td>
<td>${row.tradeCount}</td>
<td>${row.percentMatch}</td>
</tr>
<c:set var="oddEven" value="${!oddEven}" />
</c:forEach>
</table>
</body>
</html>
No comments:
Post a Comment