Mantis - Resin
Viewing Issue Advanced Details
5842 minor always 12-29-14 09:07 12-30-14 12:39
nam  
 
high  
closed 4.0.41  
no change required  
none    
none  
0005842: jsp custom tag attributes are not re-set in a loop
(rep by Yoo)

Custom tags are pooled in Resin, but tag attributes are only set once in the loop. This behavior is different from Tomcat.

This is an issue because user code may be changing attribute fields between loop iterations.

<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' [^] %>
<%@ taglib prefix='aof' uri='WEB-INF/mytags.tld' %>
<%@ page import="java.util.*" %>
<%
    List<String> list = new ArrayList<String>();
    list.add("a");
    list.add("b");
    list.add("c");
%>

<c:set var="list" value="<%= list %>" />
<c:forEach var="row" items="${list}" varStatus="i">
    <c:out value="${i.index}" />: <c:out value="${row}" />, <aof:code type="print" codeGroup="TERM_TYPE" selected="${row}" />

</c:forEach>





<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
                        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> [^]

<taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>aof</short-name>

    <tag>
        <name>code</name>
        <tag-class>test.CodeTag</tag-class>
        <body-content>JSP</body-content>
        <attribute>
            <name>type</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>codeGroup</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>selected</name>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>


</taglib>

Notes
(0006586)
nam   
12-30-14 12:39   
This is expected behavior as required by the JSP spec. To turn off tag reuse:

<web-app>
  <jsp recycle-tags="false"/>
</web-app>

jsp recycle-tags config is not working:
http://bugs.caucho.com/view.php?id=5843 [^]