Bug 20602 - The body of a <c:forEach> is not executed when begin and end attributes have the same value
Summary: The body of a <c:forEach> is not executed when begin and end attributes have ...
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-09 08:10 UTC by Ari Savolainen
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ari Savolainen 2003-06-09 08:10:03 UTC
The following jsp prints nothing for the first <c:forEach> loop
but "1 2" for the second.

<%@ taglib uri="/WEB-INF/c.tld" prefix="c"  %>

<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <c:forEach begin="1" end="1" varStatus="loop" >
            <c:out value="${loop.index}" />
        </c:forEach><br />

        <c:forEach begin="1" end="2" varStatus="loop" >
            <c:out value="${loop.index}" />
        </c:forEach><br />
    </body>
</html>
Comment 1 Pierre Delisle 2003-06-18 22:02:12 UTC
Works for me using JSTL 1.0.3.
Comment 2 Ari Savolainen 2003-08-05 09:10:01 UTC
The expected result of the jsp would be:
1
1 2

The actual result was (even in JSTL 1.0.3):

1 2
Comment 3 Felipe Leme 2003-08-22 04:44:26 UTC
Hi Ari,

I tested it on my laptop (running Mandrake Linux, Tomcat 4.1.24 and Standandard
1.0.3) and it worked as expected. Here is the output:


<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        
            1
        <br />

        
            1
        
            2
        <br />

    </body>
</html>
Comment 4 Felipe Leme 2003-08-22 04:45:15 UTC
PS: forgot to ask: what's the environment you are testing? Did you try on Tomcat
4.1.24?

Felipe
Comment 5 Pierre Delisle 2003-08-22 16:37:11 UTC
Re-tested, and this once again works fine for me.
Since this was also confirmed by Felipe, I'll go ahead 
and close this bug again (getting ready for a new release).

I'd however suggest the following:
  - Test with Tomcat 4.1.x and JSTL 1.0.3 to convince yourself
    that this works
  - Try to understand the difference between your environment and
    the one suggested above where this works



Comment 6 Serge Knystautas 2003-08-22 16:53:32 UTC
I'm seen the same bug in the JSTL 1.0.3 impl on Resin.  To my knowledge, Tomcat
doesn't efficiently recycle tags, so maybe there's something there.

I'll scan the code and if there's anything I think is suspicious, I'll let you know.
Comment 7 Ari Savolainen 2003-08-24 10:31:27 UTC
I was using Resin. It has its own implementation of
javax.servlet.jsp.jstl.core.LoopTagSupport. When I forced the use of jakarta
implementation of that class all worked fine.