Java Reference
In-Depth Information
Language (EL) makes it simpler to access JavaBean properties. The conditional and itera-
tor tags provide consistent syntax to access data from collection objects such as
List
,
Map
,
and arrays. Another important feature of JSTL is the support for i18n with locale-sensitive
messages and formatting tags. Listing 3-49 shows JSTL tags in action, iterating through a
policy search result returned as a list of
PolicyDetail
objects.
Listing 3-49.
policydetails.jsp
<%@ taglib prefix="c" uri="
http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib prefix="fmt" uri="
http://java.sun.com/jsp/jstl/fmt"
%>
<html>
<head>
<title>Underwriting</title>
</head>
<body>
<form name="policysearch" action="policysearch.do">
<%-- The search criteria inputs are not shown for simplicity --%>
<table>
<tr>
<td>Policy Id</td>
<td>First Name</td>
<td>Last Name</td>
<td>Age</td>
</tr>
<c:forEach var="policyDtl" items="${policyDtlList}" >
<tr>
<td><c:out value="${policyDtl.policyId}"/></td>
<td><c:out value="${policyDtl.firstName}"/></td>
<td><c:out value="${policyDtl.lastName}"/></td>
<td><c:out value="${policyDtl.age}"/></td>
</tr>
</c:forEach>
<tr>
