tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Deigh" <>
Subject Ambiguity with respect to setParent() and tag files
Date Tue, 27 Apr 2004 15:21:19 GMT

I am trying to resolve an ambiguity with respect to
javax.servlet.jsp.tagext.[Simple]Tag.setParent() and tag files. If I place a
tag (simple or classic, doesn't matter) at the top-level within a tag file,
should it have a parent? I had expected that its parent would be the
SimpleTag that is the tag file itself, thus providing a parent chain into
the calling JSP, but the Tomcat 5.0.19 implementation sets its parent to
null. The JSP 2.0 specification and JavaDoc say only "The setParent() method
is only called if the element is nested within another tag invocation." I
could interpret this to mean nested statically, in which case the current
behavior is correct, or nested dynamically, in which case it is incorrect.

It would be extremely useful if a tag within a tag file that expects, for
example, a transaction context provided by an ancestor tag, could
communicate with that ancestor tag even if the ancestor is in the JSP that
invoked the tag file. Otherwise, I can't generally take a portion of my JSP
and make it reusable by putting it into a tag file. In implementation, this
interpretation would mean that a tag at the top level within a tag file
should be initialized with "setParent(this)" (or "setParent(new
TagAdapter(this))") instead of "setParent(null)".

I have sent an e-mail to the JSR-152 address to request a spec
clarification. Any opinions here on the correct behavior?

Tony Deigh
RepWire, Inc.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message