I'm a bit new with jsp and now i'm facing a bit of a trouble trying to build a recursive function. What happens is I have an object which i sent by json to a variable in the jsp. That object has a few attributes and also an arrayList with his children objects of the same type as him. So I've realized I can get to his children but after that I can't without repeating the code, therefore the need of a recursive function to help me go through the children objects. Is there a good way to do this? I thought about using a java function on the jsp but how am i suppose to pass the variable into the function and turn it into a service?
I would suggest doing it with a custom tag file.
You can then recursively invoke your custom tag.
Here is a quick and stupid example I put together to demonstrate the idea.
And something that invokes it: treePrinter.jsp
Joined: Jul 06, 2005
Similar sort of separation to the custom tag example I gave, just a different approach/implementation.
Joined: Mar 27, 2012
Thanks for the help. In my case im not using a LinkedHashMap but an ArrayList. Does it work using the same logic but replacing those components? I'd like also to build the html with it, i suppose I do that within the tag right?