Hi Erik,

> Could it be that you try to iterate over a Map?

Nope - just a collection.  Here is an example of the problem (tested
with tomcat 5.0.19) :

Sample1.jsp
=======================================

<%@ page import="java.util.Collection,
                 java.util.ArrayList,
                 java.util.Date"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<%@ taglib prefix="h" tagdir="/WEB-INF/tags" %>
<html>
<style>
H1 { font-size: 1.1em; }
</style>
<body>
<h1>Tag Files and Collections - my problem...</h1>
<hr>

<c:set var="stuff" value="<%= new ArrayList() %>"/>
<jsp:useBean id="stuff" class="java.util.ArrayList"/>
<%
    //ok - put some objects in the collection
    stuff.add(new Date());
    Thread.sleep(1000);
    stuff.add(new Date());
    Thread.sleep(5000);
    stuff.add(new Date());
    Thread.sleep(5000);
    stuff.add(new Date());
%>

Confirm the collection is present and has objects in it
<ul>
<c:forEach items="${stuff}" var="item">
  <li>${item} - ${item.time}</li>
</c:forEach> 
</ul>

<hr>
Now use the collection in a tag file:<p>
<h:sample_tag1 items="${stuff}" />

<hr>
<%= new java.util.Date() %>
</body>
</html>





WEB-INF/tags/sample_tag1.tag
============================================

<%@ tag body-content="scriptless" %>
<%@ attribute name="items" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core";      prefix="c" %>
items = ${items}<p>
<table border=1>
<c:forEach items="${items}" var="anItem">
<tr>
<td>${anItem}</td>
<%-- uncomment the next line and you get an error - since the anItems
are strings... --%>  
<%--<td>${anItem.time}</td>--%>
</tr>
</c:forEach>
<td>
</table>
_____________________________________________________________

This email (including any attachments to it) is confidential, legally privileged, 
subject to copyright and is sent for the personal attention of the intended recipient 
only. If you have received this email in error, please advise us immediately and 
delete it. You are notified that disclosing, copying, distributing or taking any 
action in reliance on the contents of this information is strictly prohibited. 
Although we have taken reasonable precautions to ensure no viruses are present in this 
email, we cannot accept responsibility for any loss or damage arising from the viruses 
in this email or attachments. We exclude any liability for the content of this email, 
or for the consequences of any actions taken on the basis of the information provided 
in this email or its attachments, unless that information is subsequently confirmed in 
writing. If this email contains an offer, that should be considered as an invitation 
to treat.
_____________________________________________________________

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to