commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryl Stultz" <da...@6degrees.com>
Subject Re: [jelly] parent and child tags
Date Mon, 08 Mar 2004 19:17:49 GMT
"Jakarta Commons Users List" <commons-user@jakarta.apache.org> 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
>parentBean.

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.
http://www.6degrees.com
mailto:daryl@6degrees.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message