|
Velocity macros for recursive display of tree?: msg#00137jakarta.velocity.user
Can anybody tell me if Velocity would be given to displaying recursive structures? From a brief skimming over the macro language, it appears this would be possible by having a macro call itself. The problem I have is that I would like to display a tree structure (folders, files), but the web (or at least JSP) is a notoriously bad medium for something like this. My first cut with pure JSP was pretty painful. Just recently I wrote a generic custom tag to render trees, based on the javax.swing.tree package interfaces (TreeModel, TreeNode), but still, while being somewhat less painful, it is pretty ugly (basically the recursive descent logic is now replaced by the tag (which actually forces you to be iterative instead of recursive), but the display is still using embedded JSP). The logic is something like: <ul> render: $node if $node is a folder <li>display $node folder details if $node has children <ul> for each $node child render($child) end </ul> fi </li> else display <li>$node file details</li> fi </ul> of course there is a bit of logic in the display of the node, so I'd have to call out to methods on other classes. TIA Aaron |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | velocity text beautifier: 00137, Colin Chalmers |
|---|---|
| Next by Date: | RE: Velocity macros for recursive display of tree?: 00137, Peter Romianowski |
| Previous by Thread: | velocity text beautifieri: 00137, Colin Chalmers |
| Next by Thread: | RE: Velocity macros for recursive display of tree?: 00137, Peter Romianowski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |