You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Josh Berry <jo...@usa.net> on 2002/11/06 22:43:06 UTC

Recursive iteration using

I tried the list archives but was unable to find a solution to the following. 
If I looked in the wrong spots, a simple pointer would be awesome. :)

Basically, I have your typical tree structure.  I would like to turn this into
an unordered list in the browser.  So... I currently iterate over the top
level making a list item for each item.  This is great, but I would also like
to start and populate a list for each item that has children.

Recursively, a very simple problem. I am guessing I could just use a couple of
ugly scriptlets, but I was hoping there was a way to do this using some tags
already out there.  If not, would anyone be interested in such a tag were I to
write one?  Any suggestions on how it should act, etc?  This would be my first
attempt at a custom tag, so it would not be exactly a quick turnaround, but I
am all for doing it.

My initial thoughts were something like
<foo:ul name="collectionName" id="innerName">
  <foo:li name="innerName" property="value" />
  <foo:innerList name="innerName" property="collectionName" />
</foo:ul>

This would cause <foo:innerList> to start a new run of the <foo:ul> using the
new collectionName in this run.  Allowing me to basically feed it a tree, and
have the entire tree done out in full depth.

I would like a solution similar to this, as it would allow me to keep the jsp
page rather clean, but I am not sure if this is even possible with custom
tags.  I am hoping that it has been done, but I am just looking at it the
wrong way.

Thanks for any input,

-josh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>