I am a dedicated user of freemarker. I find it the best template engine for Java to date. It's flexibility and simplicity beats another template engine, IMO. 

However, I have also been thinking about the how powerful it would be to have the same templating on the web client (i.e browser) and on the server. This capability, combined with a good framework and application model could be an extremely powerful and simple way to develop advanced HTML(5) web and mobile applications.  

The use-case, is that usually, for performance and SEO, you want the initial HTML rendering happen on the server, however, you want the subsequent partial renderings happen on the client. Today, these two requirements seem to be mutually exclusive. Either you do all the rendering on the client side (with framework like GWT), or you use the traditional way of doing HTML/DOM generation on the server side (using jQuery for adding behavior).

Personally, I am not a big fan of the GWT way of doing web app since it tries too hard to remove the developer from Javascript and HTML, while I think it is better way would be to empower them to maximize the potential of HTML/JS for all HTML application types (multi-page, single page, hybrid, and mobile -phoneGap style-). 

Mustache.js is a good example of a portable rending engine, however I think it is too limited and the Java implementation does not seem to be truly java(bean) compliant. 

So, my thinking would be to have something in between freemarker and mustache, but completely java or javascript portable. So, assuming the json structure maps the java object structure, it trivial to render the same template on the client side or server side. 

Anyway, I am just curious to know if someone from the freemarker community (or developers) are having similar thought and get some feedback. I would happily code something up, but I do not have much experience yet at parsing/compiling templates. 


Jeremy Chone
+1 415 699 9912