<!-- Load our custom tag library -->
<%@ taglib uri="/search.tld" prefix="pf" %>
<!-- Import the core JSTL tags -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
  <!-- Perform the search -->
  <pf:search varName="people" 
             firstNamePattern='<%= request.getParameter("firstName") %>'
             lastNamePattern='<%= request.getParameter("lastName") %>'
             emailPattern='<%= request.getParameter("email") %>' />
  <center>
  <form action="email" method="post">
  <c:choose>
  <c:when test="${requestScope['people-error'] == null}">
    <table border="0" width="50%">
      <tr bgcolor="#CCCCCC"><td colspan="5" align="center">Search Results</td></tr>
      <tr bgcolor="#EEEEEE">
        <th>First name</th>
        <th>Last name</th>
        <th>Email Addresses</th>
      </tr>
      <!-- Iterate through the results and print them each in a row -->
      <c:forEach var="person" begin="0" items="${people}" varStatus="stat"> 
        <tr bgcolor="#CCCCFF">
          <td><c:out value="${person.firstName}"/></td>
          <td><c:out value="${person.lastName}"/></td>
          <td>
            <c:forEach var="addr" begin="0" items="${person.emailAddresses}">
              <a href='mailto:<c:out value="${addr}"/>'><c:out value="${addr}"/></a><br>
            </c:forEach>
          </td>
        </tr>
      </c:forEach>
    </table>
  </c:when>
  <c:otherwise>
    <h3><font color="#FF0000">Error: <c:out value="${requestScope['people-error']}"/></font></h3>
  </c:otherwise>
  </c:choose>
  </form>
  </center>
</body>
</html>
