The Spring I/O 2012 Madrid is over, and we have published both the slides (in English) from our talk and the interactive tutorial from our workshop at our special Thymeleaf at the Spring I/O 2012 page.

17 May 2012: New version: Thymeleaf 2.0.8 has been released! This is a minor bugfixing version, and is a drop-in replacement for 2.0.x versions. Download and see ChangeLog.

02 May 2012: José Miguel Samper has just published PagesDialect, a Thymeleaf custom dialect providing pagination, sorting and exporting of data listings. See it at our Thymeleaf Ecosystem page.

01 May 2012: Jim Benson has just published version 0.1.0 of Thymol, the javascript companion library for Thymeleaf that enables the evaluation of th:include and th:substituteby attributes directly on static prototypes, before being executed by Thymeleaf. This new version features conditional evaluation of th:if, th:unless and th:switch conditions based on request parameters (directly written as parameters of the static template at the browser URL bar) and a debug mode to aid development. See it at our Thymeleaf Ecosystem page.

What is Thymeleaf?

Thymeleaf is a Java library. It is an XML / XHTML / HTML5 template engine (extensible to other formats) that can work both in web and non-web environments. It is better suited for serving XHTML/HTML5 at the view layer of web applications, but it can process any XML file even in offline environments.

It provides an optional module for integration with Spring MVC, so that you can use it as a complete substitute of JSP in your applications made with this technology, even with HTML5.

The main goal of Thymeleaf is to provide an elegant and well-formed way of creating templates. Its Standard and SpringStandard dialects allow you to create powerful natural templates, that can be correctly displayed by browsers and therefore work also as static prototypes. You can also extend Thymeleaf by developing your own dialects.

For more detail, have a look at the complete list of features.

How does it look like?

It looks like this:

<table>
  <thead>
    <tr>
      <th th:text="#{msgs.headers.name}">Name</th>
      <th th:text="#{msgs.headers.price}">Price</th>
    </tr>
  </thead>
  <tbody>
    <tr th:each="prod : ${allProducts}">
      <td th:text="${prod.name}">Oranges</td>
      <td th:text="${#numbers.formatDecimal(prod.price,1,2)}">0.99</td>
    </tr>
  </tbody>
</table>

A quick look at this piece of code reveals internationalization expressions (#{...}), variable/model-attribute evaluation expressions (${...}) and even utility functions (#numbers.formatDecimal(...)). It also shows that this fragment of (X)HTML code can be perfectly displayed by a browser as a prototype, without being executed at all —something called a natural template.

But there's so much more: full (optional) Spring MVC integration - including form binding, property editors and validation messages -, XML validation artifacts, text/javascript inlining and an intelligent template cache system.

Again, for more detail have a look at the complete list of features.

How is it distributed?

Thymeleaf is Open Source Software, and it is distributed under the terms of the Apache License 2.0.

Where can I start learning about it?

You should start by reading the tutorials at the documentation page.

How can I keep updated about Thymeleaf?

One of the best ways to do it is to follow us on twitter, but you can also subscribe to our News and Announcements Forum.

Project Status

Thymeleaf is production-ready. Current stable version is 2.0.8.

Have a question?

Post it at our User Forum.