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 20:06:52 GMT
"Jakarta Commons Users List" <commons-user@jakarta.apache.org> writes:
>
>I like the way you worded that.  I "discovered" it too.  ;-)
>This really needs to go into the documentation if it is in fact the best
>way
>to do this.

I agree. I found it via the API docs.
>
>Yes, that would certainly work.  I'm just thinking that if I have an
>element
>with 20 different child elements, I don't want to create a class for each
>of
>the child elements and have to tell each one to pass its data up to the
>parent.

Well, you still have to create a class for each child element, don't you?
You need something to operate on the tag.

I would think all the parent/child handling code could go in a single
superclass tag or an interface with an operator class to do the passing,
rather than reimplementing it in each child tag.

>  I guess what I really want is a way to treat child elements like
>attributes are treated ... set methods are automatically called.  For
>example, I want
>
><foo>
>  <bar>7</bar>
></foo>
>
>to result in creation of a foo object and the call foo.setBar(7).

In this case, bar is an element/object, not an attibute/primitive value,
so the above code should not call foo.setBar(7). It would be identical to
<foo bar="7" />.
Maybe what you want is the parent tag to automatically maintain a list of
its children and then provide access to the child tags/beans. While I
don't like wasting a superclass (super to Foo but sub of TagSupport) it
would be easy enough to implement this for you own work (if/until the
Jelly folks add the feature).
>


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