This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
In spring web mvc I couldn't find some fundamental layout features such as decorating templates (separating columns, footers, headers, etc. into reusable jsp files). I read several opinions on the web that the best UI to use along with spring web mvc is apache tiles. Some said that it can also be sitemesh.
Lately I've been trying to use Apache Tiles with my spring project and I'm somehow disappointed, because it is not as developer-friendly as I expected. Tiles implement composite view, whereas sitemesh implement decorator pattern. This is fundamental difference, since decorator is easier for developer to use and - imho - more flexible (e.g. it enables to override variables in the child views, not in xml definitions). I would like to get your opinions on where Tiles (a composite-view-based templating engine) can be better than a decorator pattern? And what do you use?
Yep, as you can see, I'm a JEE newbie ;) I've been working in PHP until now and I must say that almost every PHP templating engine has all important features built in (no need to include .tld files). In JEE you've got to use JSP + JSF or Tiles or Sitemesh - I wonder why isn't it just all included in spring web mvc? I can't imagine a big website that doesn't have a well-implemented templating engine (e.g. inheritance) - this forces the developer to choose several tools to build only the UI part of a system (django, ruby on rails, symfony - they cover all those topics all by theirselves).
Spring MVC handles view resolution. The view implementation is left up to the developer, I would rather not have to choose one. I appreciate the fact that different view implementations are better for different use cases. Whether I choose JSP, static HTML, Freemarker, Velocity, JSF etc. I have that choice. A lot of thought has gone into the development of each of these and Spring MVC does not look to redo that work but rather to make it as painless and flexible as possible for the developer to use any of them.
Besides rendering a view there is the problem of mapping requests to a handler (while remaining flexible), resolving the view to render, handling things like locales, and themes, data binding, validation, form uploads etc. This is the type of thing Spring MVC focuses on. It really revolves around the Dispatcher Servlet which is an implementation of the well known J2EE front controller pattern.
Now I personally don't like jsp pages or any server side rendering of pages. I prefer the Single Page Web App with AJAX/REST calls to my serverside, where the server side only returns json data (after the initial index/home request) Then on the client side I use ICanHaz.js, which is built on top of Mustache. It is a very simple to use templating engine. Probably more similar to what you had in PHP.