This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Implementing Tree Nav Menu

Jun 9th, 2006, 12:26 PM

Hi all,

I'm still rather new to Java and Spring (been doing this for the past three months or so) and need some pointers on implementing our app's view. Specifically, I need to implement a dynamic tree menu on the left of the screen that is consistent throughout our application, which displays the proper view on the main right panel according to what was clicked.

Originally, the layout of each view had navigation links within each page depending on what the controller returned as the model and view. The tree menu I worked on would need all links throughout the entire app. This would look and function something like a Windows file explorer tree, where clicking on a node to the left will reflect a new view in the main panel.

What I did was include a NavBar.jsp page and included that into every view within the app. I know that's bad, but we had to meet a demo deadline. There was a problem with this: My NavBar.jsp page would try to access all the models available within the app to display what I needed in the tree. However, each view's controller only returned a subset of all the models. I had to hack away at it somewhat by modifying each controller to include every model that I needed within that particular view.

Another I issue that I need to resolve is keeping the state of the tree's expanded and collapsed nodes so that it is consistent. B/c the entire page refreshes now, the tree is always in its initial collapsed state.

As for the state of the tree, is there a frame like method of keeping the tree static or maintaining its states? Since nodes on the tree may be added or deleted (adding a company, delting a company), I have to keep that in mind as well.

Thanks in advance to all you guys in the forums. I'm a newb in sw development and have learned a lot from reading your posts!