Mantis Bugtracker
  

Viewing Issue Simple Details [ Jump to Notes ] [ View Advanced ] [ Issue History ] [ Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000046 [Resin] minor always 03-22-05 00:00 05-11-05 00:00
Reporter sergek View Status public  
Assigned To
Priority urgent Resolution fixed  
Status closed   Product Version 3.0.12
Summary 0000046: Tag re-use finding wrong parent
Description RSN-37
I have a custom tag library that looks for a parent tag. For example:

<i:select>
  <c:forEach>
    <i:option></i:option>
  </c:forEach>
</i:select>

The option tag interacts with the select tag, so in my custom tag's doStartTag(), I have

SelectTag parent = (SelectTag) TagSupport.findAncestorWithClass(this,
                SelectTag.class);

I'm getting an exception when I have multiple select/option blocks. The problem seems to be how the tags are created and later reused. Here is the generated code for the option tag:

if (_jsp_OptionTag_5 == null) {
    _jsp_OptionTag_5 = new com.lokitech.jsp.input.OptionTag();
    _jsp_OptionTag_5.setPageContext(pageContext);
    _jsp_OptionTag_5.setParent((javax.servlet.jsp.tagext.Tag) _jsp_int_loop_1);
}

The second time the option tag is used, you have generated code that looks like this:

if (_jsp_OptionTag_5 == null) {
    _jsp_OptionTag_5 = new com.lokitech.jsp.input.OptionTag();
    _jsp_OptionTag_5.setPageContext(pageContext);
    _jsp_OptionTag_5.setParent((javax.servlet.jsp.tagext.Tag) _jsp_int_loop_2);
}

The second time this is run, obviously the _jsp_OptionTag_5 instance has already been created, and thus _jsp_int_loop_2 is not set as the parent.

My custom tag either then gets the wrong parent tag (the first select tag), or it gets none (because of how I use forEach tags elsewhere on the page.)
Additional Information Tested on Resin 3.0.10 through 3.0.12. Both Linux RH deployment and Windows XP development. JDK 1.4.2_07.
Attached Files

- Relationships

- Notes
(0000051)
sergek
03-22-05 00:00

Here is the JSP that shows this behavior. I will attach the JAR taglib in a sec.
 
(0000052)
sergek
03-22-05 00:00

This is open source and will eventually get published at http://sf.net/projects/ivytags. [^]
 
(0000053)
sergek
03-22-05 00:00

Generated java file showing wrong parent setting.
 
(0000054)
ferg
03-22-05 00:00

jsp/1cm5
 

- Issue History
Date Modified Username Field Change
03-22-05 00:00 sergek New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.13


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
30 unique queries executed.
Powered by Mantis Bugtracker