<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="java.util.*"%>
<html>
<head>
  <title>JSTL: Iterator Support -- Data Types Example</title>
</head>
<body bgcolor="#FFFFFF">
<h3>Data Types</h3>
<%
 int[] myIntArray=new int[]{1,2,3,4,5,65,34};
 String[] myStringArray=new String[]{"I ","am ","a ","Java","fans"};
 Vector v=new Vector();
 v.add("this");
 v.add("is");
 v.add("myEnumeration");
 v.add("!");
 Enumeration myEnumeration=v.elements();
 HashMap myNumberMap=new HashMap();
 myNumberMap.put("hellking","23");
 myNumberMap.put("guest","23");
 myNumberMap.put("guest2","223");
 myNumberMap.put("guest3","232");
request.setAttribute("myIntArray",myIntArray);
request.setAttribute("myStringArray",myStringArray);
request.setAttribute("myEnumeration",myEnumeration);
request.setAttribute("myNumberMap",myNumberMap);
%> 
<h4>Array of primitives (int)</h4>

<c:forEach var="i" items="${myIntArray}">
  <c:out value="${i}"/> ?
</c:forEach>

<h4>Array of objects (String)</h4>

<c:forEach var="string" items="${myStringArray}">
  <c:out value="${string}"/><br>
</c:forEach>

<h4>myEnumeration (warning: this only works until myEnumeration is exhausted!)</h4>

<c:forEach var="item" items="${myEnumeration}" begin="0" end="5" step="1">
  <c:out value="${item}"/><br>
</c:forEach>

<h4>Properties (Map)</h4>

<c:forEach var="prop" items="${myNumberMap}" begin="1" end="5">
  <c:out value="${prop.key}"/> = <c:out value="${prop.value}"/><br>
</c:forEach>

<h4>String (Common Separated Values)</h4>

<c:forEach var="token" items="red,blue,green">
  <c:out value="${token}"/><br>
</c:forEach>
</body>
</html>

