This is a vague and grand question but hopefully I can explain it with as little concrete examples as possible.
We recently switched to Spring MVC for our application framework but found one (and really, only one) limiting factor during development: how to include dynamic views with the appropriate model.
For instance, we are creating a page that contains reusable fragments. On the left we have a "random q and a" fragment while on the top we have a common "navigation" fragment.
Each of these fragments requires a different model. I have been instructing the developer that is creating the "navigation" portion to create a navigation model, controller and view completely separate of the "q and a" model, controller and logic. This is to encourage reusability if another page layout wants the "navigation" but not the "q and a" or vice verse.
Do you see where I am going with this? The "home" page includes both fragments but it would be nice to not have to "known" which controller/model/view the fragments need.
I've been instructing developers to use Spring MVC in the following manner....
Example of home.jsp:
<body>
<div class="top">
<jsp:include page="/navigation"/>
</div>
<div class="left">
<jsp:include page="/randomgQuestion"/>
</div>
</html>
The idea is at request time the necessary other fragments will be pulled in dynamically with the models that they require.
Is this a good idea? Is there a better way?
Any discussion is welcome but please be constructive.
The goals are reusability and dumb views.
I'll offer any updates or clarifications upon request. Thank you.