commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryl Stultz" <>
Subject Re: [jelly] parent and child tags
Date Mon, 08 Mar 2004 19:17:49 GMT
"Jakarta Commons Users List" <> writes:
>The simplest way for a child tag object to obtain its parent tag object is
>  DynamicBeanTag parentTag = (DynamicBeanTag) getParent();
>  Object parentBean = parentTag.getBean();
>  // At this point a cast is necessary to do anything useful will

This certainly works and I "discovered" this solution myself. Can't say if
it's the simplest or most elegant, though.
>Parent tag objects cannot, in their doTag method, locate their child tag
>objects and invoke methods on them to "pull" data up.  I'm really hoping,
>I'm wrong about this.

If you have the children can push themselves to the parent during
invokeBody(...), then the parent can process them after the call to
invokeBody(...), no?

// parent code:
	public void doTag(XMLOutput output) throws Exception {
		invokeBody(output); // children push themselves up...
		processChildren(); // iterate over children doing whatever

Daryl Stultz
6 Degrees Software and Consulting, Inc.

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

View raw message