Tiles and Sitemesh look quite popular but this stuff is really old and look terrible compared to current awesome stuff from e.g. Ruby (ERB) or PHP (Open Power Template). These days template engines allow comfortable templating (inserting variables, autoescaping depending on the context, iterating through Iterables, accessing bean properties) and layouting (e.g. headers, footers and overriding and adding to some parts defined in parent) without any difficult configuration and wihout a need for changing your current stack (e.g. your web framework).
Example parent.html:
<html>
<head>
<title>
<layout:part name="title">
Default title
</layout:part>
</title>
<layout:part name="head" />
</head>
<body>
<div class="menu" layout:part="menu">
default menu
</div>
<div class="content" layout:part="content" />
<div class="footer">
(c) me
</div>
</body>
</html>
Example child.html
<layout:extend file="parent.html">
<layout:fill name="title">
Custom title
</layout:fill>
<layout:fill name="contnet">
the content
{$var} from model
</layout:fill>
</layout:extend>
I'm looking for better Facelets, that won't require me to change the whole stack - I'm not going to adapt the whole project to JSF or Wicket just to use better views.
The template engine should not require any additional servlets or filters (no URL-based logic). I want to use the engine programatically. A possible use case is defining a custom ViewResolver in Spring 3.
It would be perfect if layouts weren't defined up-front in a config file. That's not needed if you just define the parent view in the template file.
The framework may be on top of JSP but doesn't have to. The advantage is a possibility to use taglibs provided by other frameworks (e.g. Spring).
Or maybe everything is already there in Sitemesh/Tiles but needs lots of configuration? If you know of any example configuration that allows to achieve all the mentioned goals, let me know about it.
Related question: what alternatives exist to Sitemesh to help layout JSP/JSTL page footers/headers in a Spring MVC app? - my question refers to templating too, and is not limited to Spring Web MVC.