Hello All,
So I'm working on hand-coding a forum-like website, just for the experience, and I want to have a similar feature as you'll see above where a thread will have its ancestors linked: "Web Development > JSP > Parent traversal of tree-like Structure"
I have several beans for different things, post, thread, category, forum and so on, all have a name property and all (will shortly, still adding) have a parent property.
I know I could do this all in Java code inside a tag handler that would just print the whole thing, but I'd rather do it in the JSP so that formatting will be more easy to tweak. In psudocode it would look something like:
while(currentthing.parent!=null)
add currentthing.parent to ancestors
currentthing=currentthing.parent
reverse ancestors
for thing in ancestors
format and print link to thing and " > "
print this pages title inline with links
For now I do intend to just implement this in Java as a standalone custom tag (a bit difficult because everything is a different class, no ABC for all my beans, though i could make one for the name and parent attributes), but I want to know if there's a better way to do it.