I am novice in Spring framework. In my project I use Spring framework and tiles 2(menu, header, body and footer). I want create dynamic menu and load it at the menu tile (create controller for menu tile). How can I do that? If I skip some posts, please, tell me.
Share
What you tryed is some kind of component based stuff (like JSF), but this does not work for Spring MVC, because Spring MVC is a command based Web Framework.
In the end your problem is, that you need to add the model, generated by your Menu-Controller in all models created by any other controller.
I see two ways to do it.
postHandle
org.springframework.web.servlet.HandlerInterceptoris a kind of Filter that get invoked (before each controller method is invoked, after the controller method retuns and before the jsp is “invoked”, after the jsp “returns”). So you rewrite your Menu Controller to an HandlerInterceptor that use thepostHandleMethod (the one between controller and jsp) and add there the model for your menue.@see