MVC
pattern:
servlets +
JSP pages.
I have a class `Category`with (basic) look:
This class should represent category-subcategory concept: one category can have multiple subcategories, category does not need to have a parent (top level category, parentCategory field is null), if it is a subcategory then its parentCategory field represents its parent).
In servlet, i extract all categories from database to a
java.util.List object. Then i attach this list to application scope(servlet context) and forward it to JSP page.
Now, in JSP page, i have a navigator menu, you can see it here:
http://jsfiddle.net/vvozar/tMz9A/1/
(`see menu look in jsfiddle link`)
Dropdown menus are simple unordered lists in HTML, and its submenus are nested unordered lists under certain menu items. Example (static):
I would like to create these menus and submenus (dynamically) by reading categories/subcategories from the list, following category hierarchy.(categories with same parent belong to same dropdown menu). I dont know how to approach, because i dont know how deep will submenus go.
How should JSTL loop for creating categories menu look?