Hi there,
I need some guidance with creating a custom iterate tag (literally like the
standard IterateTag, but where I can control what happens). I tried to find
good examples or tutorials on how to do this, but couldn't find anything
good so please advise if you know of anywhere good to look that is up to
date.
Previously I developed a class called TreeTraverserTag which extends
TagSupport. It takes the following attributes name, traverser, etc. and then
paints a pretty Windows like tree with multiple level nodes in the browser
based on the tree structure. Now however I want to change this tag to
instead iterate over the nodes and write HTML based on each nodes properties
(like a different colour or icon based on type, etc.).
Please advise which class to I need to extend or interface I need to
implement so I can control the next(), hasNext(), etc. methods (as the tree
is hierarchical with nodes that can expand or collapse, therefore not a
standard collection or Array) as well as being able to write out the HTML
for each iteration. Examples or tutorials would be welcome. I tried a couple
of classes and interfaces but ran into problems due to a lack of experience.
Things like the doAfterBody method was never called , or it went into a
loop, etc.
At the moment my tag looks like this:
t:tree name=myTree traverser=${treeTraverser}
defaultNodeClass=defaultNode
defaultNodeImgageUrl=/folder.gif
selectedNodeClass=selectedNode
selectedNodeImgageUrl=/folder2.gifcellpadding=1
cellspacing=0 border=1 width=100%
styleClass=myTable
/t:tree
Ultimately I want to do something like this (if it is possible):
t:tree name=myTree var=node traverser=${treeTraverser}
icon name=blue src=blue.gif/
icon name=red src=red.gif/
c:if test=${node instanceOf Document}
DISPLAY RED
/c:if
c:if test=${node instanceOf Resource}
DISPLAY BLUE
/c:if
/t:tree
Much appreciated.
Kind regards,
Maruis Botha
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]