> -----Original Message----- > From: Daryl Stultz [mailto:[EMAIL PROTECTED] > Sent: Monday, March 08, 2004 2:07 PM > To: Jakarta Commons Users List > Subject: RE: [jelly] parent and child tags > > "Jakarta Commons Users List" <[EMAIL PROTECTED]> 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.
Not if the parent has access to all its child tags with its doTag method. > 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). Are you saying that there is already a method in Jelly that allows a class like Foo to access its child tags/beans? If so, can you point me to it? ------------------------------------------------------------------------------------- A.G. Edwards & Sons' outgoing and incoming e-mails are electronically archived and subject to review and/or disclosure to someone other than the recipient. -------------------------------------------------------------------------------------
