I’m starting out a Spring MVC 3.0 application and getting controllers and views working nicely, the one thing I now need to do is get navigation working. So for each view I have, it needs to know what item in the “menu” part of the view to highlight and what menu options are available to that view.
One thing I thought of was to get the controller to tell the view where it is, but that’s binding view logic into the controller. My views menu is in its own include which I include within each view.
What are your approaches? I’m thinking of using tiles, to this point I’ve only been using JSP and JSTL, maybe this will help?
I recommend you to use tiles as a view manager, and a viewNameTranslator like this:
So this way you can avoid specifing view names on controller class returning void.
later on tile-def.xml
you define a view somethin like this:
This way menu.jsp receives an aditional parameter highlightedView with the info you need.-
Hope it helps.