I have a similar need to the one expressed by Kirby. I have not used the nested extension, but, I have read through the online primer. I saw nothing there that would indicate it would handle *dynamic* tree structures. Yes, you can use the nesting custom tags to any depth you want. Yes, you don't need to know in advance how many items there are in a collection at a particular level. However, it looks like you need to know in advance what depth to go to. When the tree is being generated dynamically and the depth can not be known in advance, I don't see how to use the nesting extension to handle it.
I hope that I am wrong about that because I'd love to just use the nesting extension rather than write something on my own. If the nesting extension can handle this situation, please point me to the right part of the docs or an existing example that will help me figure that out. Assuming I am right and the nesting extension doesn't handle what I need yet, my sense is there might be a way to enhance the nesting extension to handle this for recursive structures. For example, consider a Node object that had some instance data and a collection of child Node objects and a getChildNodes() method. What if <nested:iterate> took an additional parameter which was recurseProperty="childNodes"? It should be possible to implement tail recursion in the implementation of <nested:iterate> that would repeat the execution of the body of the <nested:iterate> tag with the new collection being the one returned from the getChildNodes() call on the current node. This would do a depth first recursion of nodes outputting the same information for each node. Assuming there is a way to get depth information, I could use that information in the body of my <nested:iterate> and dynamically reflect that in the formatting of the nodes for display too. Of course, it is not that simple. There would be intermediate state to maintain and correctly return to and continue on from for each time a recursion to another level happened. The nesting extension does quite a bit already and this may not be the best way to solve my recursive structure handling problem. Then again, maybe it would make sense. I thought it was at least worth sharing the idea. - Mike Van Riper mailto:[EMAIL PROTECTED] > -----Original Message----- > From: Sri Sankaran [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 04, 2002 11:29 AM > To: Struts Users Mailing List > Subject: RE: iterate question > > > Look at the nested extension @ > http://www.keyboardmonkey.com/next/index.jsp. It is exactly > for this purpose. > > It is included as part of Struts 1.1.x > > Sri > > > -----Original Message----- > > From: Kirby Vandivort [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, September 04, 2002 12:13 PM > > To: [EMAIL PROTECTED] > > Subject: iterate question > > > > > > Hello, > > > > I'm new to struts, so please bear with me. I'm in the early > > stages of converting something to the struts framework and > > I've run into a situation that I'm not sure how to handle. > > > > I want to make a page that, as an example, looks like: > > > > - message 1 > > - message 2 > > * re: message 2 > > + re: re: message 2 > > * re: message 2 > > * re: message 2 > > - message 3 > > > > > > etc. So, I'm going to pass a collection to the jsp page, and > > the collection might contain collections. There can be any > > level of nesting. > > > > This seems like a common case, but I haven't found a way to > > do it using the struts tags as of yet. It really needs some > > sort of recursive solution since you don't know how many > > levels you will need to go down, and the presentation is > > something that clearly shouldn't be done on the business > > side, so any help or guidance that you have would be appreciated. > > > > Thanks! > > > > -- > > > > Kirby Vandivort Theoretical Biophysics Group > > Email: [EMAIL PROTECTED] 3051 Beckman Institute > > http://www.ks.uiuc.edu/~kvandivo/ University of Illinois > > Phone: (217) 244-5711 405 N. Mathews Ave > > Fax : (217) 244-6078 Urbana, IL 61801, USA > > > > -- > > To unsubscribe, e-mail: > > <mailto:struts-user-> [EMAIL PROTECTED]> > > For > > additional commands, > > e-mail: <mailto:[EMAIL PROTECTED]> > > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>