Bug 45451

Summary: Tag file attribute evaluation
Product: Tomcat 6 Reporter: herve
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.16   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

Description herve 2008-07-22 01:37:27 UTC
Hello,
I have an web app with 2 tag files.
Here is my first tag 'testtag':

<%@ tag %>
<%@ attribute name="onLoad" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:if test="${! empty onLoad}">
   <input type="hidden" name="OnLoadParameter" value="${onLoad}" />
</c:if>

My second tag ('testtag2') use the first one:

<%@ tag %>
<%@ attribute name="name" %>
<%@ taglib prefix="widget" tagdir="/WEB-INF/tags/widgets" %>

<widget:testtag onLoad="{Script:'jsFunction(\\\'${name}\\\')'}" />


In a JSP, I use the second tag:

...
<%@ taglib prefix="widget" tagdir="/WEB-INF/tags/widgets" %>
...
<widget:testtag2 name="toto" />
...


With tomcat 5.5.25, I have the following result:
<input type="hidden" name="OnLoadParameter" value="{Script:'jsFunction(\'toto\')'}" />

And with tomcat 6.0.16:
<input type="hidden" name="OnLoadParameter" value="{Script:'jsFunction('toto')'}" />

It seems that the attribute is evaluate once more on tomcat 6 than on tomcat 5.
Comment 1 ilango 2008-08-10 09:35:44 UTC
(In reply to comment #0)
> Hello,
> I have an web app with 2 tag files.
> Here is my first tag 'testtag':
> 
> <%@ tag %>
> <%@ attribute name="onLoad" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> 
> <c:if test="${! empty onLoad}">
>    <input type="hidden" name="OnLoadParameter" value="${onLoad}" />
> </c:if>
> 
> My second tag ('testtag2') use the first one:
> 
> <%@ tag %>
> <%@ attribute name="name" %>
> <%@ taglib prefix="widget" tagdir="/WEB-INF/tags/widgets" %>
> 
> <widget:testtag onLoad="{Script:'jsFunction(\\\'${name}\\\')'}" />
> 
> 
> In a JSP, I use the second tag:
> 
> ...
> <%@ taglib prefix="widget" tagdir="/WEB-INF/tags/widgets" %>
> ...
> <widget:testtag2 name="toto" />
> ...
> 
> 
> With tomcat 5.5.25, I have the following result:
> <input type="hidden" name="OnLoadParameter"
> value="{Script:'jsFunction(\'toto\')'}" />
> 
> And with tomcat 6.0.16:
> <input type="hidden" name="OnLoadParameter"
> value="{Script:'jsFunction('toto')'}" />
> 
> It seems that the attribute is evaluate once more on tomcat 6 than on tomcat 5.
> 

I would like to test this behaviour. Do you have a simple test case?
Comment 2 Mark Thomas 2008-09-16 14:14:55 UTC
I have committed a fix for this to trunk and proposed it for 6.0.x. The patch also includes various fixes around handling \${...}

Any testing you can do would be appreciated.
Comment 3 Mark Thomas 2008-10-27 06:34:52 UTC
The final fix for this got caught up in a spec query (http://markmail.org/message/2rq3vkvx76vmhq75). This has been resolved and the fix has now been applied to 6.0.x. It will be in 6.0.19 onwards.