Mantis - Resin
Viewing Issue Advanced Details
3752 major always 11-09-09 07:29 03-24-10 17:46
biku  
ferg  
normal  
closed 3.1.4  
fixed  
none    
none 4.0.6  
0003752: jstl xml forEach varStatus does not report right status
varStatus of forEach loop on xml taglib of jstl has this bug:
varStatus attribute does not report 'last' & 'first' status - it is always 'false'

Tested it in 3.1.4 | 3.1.9 | 4.0.1

Here is the sample code, just put it in a jsp page:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" [^] prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" [^]  prefix="x" %>

============

<c:set var="docString">
<doc>
<a><b foo="foo">foo 1</a>
 <a><c foo="bar">bar 2</c></a>
 <a><d foo="bar">bar 3</d></a>
 <a><d foo="foo">foo 4</d></a>
</doc>
</c:set>

<x:parse var="document" doc="${docString}"/>

<x:forEach select="$document//a" varStatus="status">
 ${status.index}: <x:out select="."/> first:${status.first} last:${status.last}

</x:forEach>
===========

Notes
(0004486)
ferg   
03-24-10 17:46   
jsp/1g5c