Thymeleaf

The Thymeleaf ecosystem is composed of tools and extensions of two types:

  • Official extensions (a.k.a. Thymeleaf Extras): created by the Thymeleaf Team and supported as a part of the project.
  • Unofficial or Community extensions: linked from this page but developed and maintained by Thymeleaf users outside of the Thymeleaf Project and distributed under their own license and support terms.

Official Tools & Extensions

Thymeleaf Testing Library

https://github.com/thymeleaf/thymeleaf-testing

The Thymeleaf Testing library allows developers to create automated tests for Thymeleaf applications and extensions in a very easy and declarative way. Among its features:

  • Works as an independent library, callable from multiple testing frameworks like e.g. JUnit.
  • Tests only the view layer: template processing and its result.
  • Allows specifying test input as markup fragments and also as links to the template files of a Thymeleaf-based application being developed, in order to easily test its view layer.
  • Versatile testing artifacts: test sequences, iteration, concurrent execution...
  • Spring Framework and Spring Security integration.

Test specifications can be as simple as this:

Thymeleaf Eclipse Plugin

https://github.com/thymeleaf/thymeleaf-extras-eclipse-plugin

The Thymeleaf plugin for Eclipse IDE adds content assist features that make working in Thymeleaf templates nicer and much more comfortable.

  • Code completion of Thymeleaf attribute processors.
  • Detailed explanations for each attribute.
  • Content assist inside expressions: expression utility objects.
example

Thymeleaf + Apache Tiles 2

https://github.com/thymeleaf/thymeleaf-extras-tiles2

The Thymeleaf Extras Tiles 2 library provides a dialect that allows using Apache Tiles 2 as the layout method of Thymeleaf-based applications. Features:

  • Use Thymeleaf templates in Tiles definitions.
  • Use Thymeleaf template fragments in layout definitions, natural templates possible with Tiles!
  • Mix JSP and Thymeleaf templates in the same layout if required.
  • Optional Spring MVC 3 and Spring Web Flow 2.3 integrations.

With this library, Tiles definitions can specify Thymeleaf templates, or even only fragments of them (in the usual th:include notation):

...and templates can call the Thymeleaf Tiles Dialect to include other parts of the layout:

Thymeleaf + Spring Security

https://github.com/thymeleaf/thymeleaf-extras-springsecurity

The Thymeleaf Extras Spring Security library provides a dialect that allows integrating several authorization and authentication aspects of Spring Security (versions 3.x, 4.x and 5.x) into Thymeleaf-based applications. Features:

  • Thymeleaf-based equivalent to the Spring Security JSP tag library.
  • Adds new expression utility objects like #authentication and #authorization for integrating Spring Security capabilities into Thymeleaf expressions.
  • Adds new attributes like sec:authentication and sec:authorized for easier configuration of security.

With this library, role-based access restrictions defined in Spring Security can be easily used:

The security-related objects can also be included in your normal Thymeleaf expressions:

Thymeleaf + IE Conditional Comments

https://github.com/thymeleaf/thymeleaf-extras-conditionalcomments

The Thymeleaf Extras Conditional Comments library provides support for Internet Explorer conditional comments in Thymeleaf templates.

  • Process Thymeleaf attribute processors inside conditional comments.
  • Supports the whole syntax of conditional comments.

IE Conditional comments look like this:

...and thanks to this library, they are correctly executed like:

Community Dialects

Developed and maintained by Thymeleaf users outside of the Thymeleaf Project and distributed under their own license and support terms.

Thymeleaf Layout Dialect

by Emanuel Rabina

https://github.com/ultraq/thymeleaf-layout-dialect

A dialect for Thymeleaf that allows you to use layout/decorator templates to style your content, as well as pass entire fragment elements to included pages, all to help improve code reuse. If you've ever used SiteMesh for your JSPs, or Facelets with JSFs, then the concepts of this library will be very familiar to you.

Dandelion Project

by Thibault Duchateau and Romain Lespinasse

https://dandelion.github.io

Dandelion is a free and Open Source Java framework aimed at making web development simpler in JVM-based environments.

It helps to manipulate the web assets (JS, CSS) in many ways: good organization and classical optimizations like minification, merging, compression or caching. It also facilitates the integration of powerful JavaScript libraries thanks to a set of extensible components.

PagesDialect

by José Samper

http://pagesdialect.sourceforge.net/

PagesDialect is a custom dialect that provides some Collection processing utilities, like pagination, sorting or exporting.

Thymeleaf With Dialect

by Martin Frey

https://github.com/Antibrumm/thymeleaf-extras-with-dialect

A dialect for Thymeleaf that allows you to use attributes with a "with" prefix to avoid having long th:with expressions.

Thymeleaf Cache Dialect

by Martin Frey

https://github.com/Antibrumm/thymeleaf-extras-cache-dialect

Some parts of our webpage will not change often during the lifetime of the application or is dependent only on a usersession.

This dialect will cache the resulting output of the element it is declared on and will replace the element on a cache hit.

HTML5 Validation Dialect

by Francisco Pérez and José Samper

http://html5valdialect.sourceforge.net/

This dialect reads JSR-303 annotations and modifies the HTML code introducing HTML5 form validation code matching the annotations.

WUIC Dialect

by Guillaume Drouet

https://wuic.github.io/

WUIC is a Java project that helps developers manage their web statics. JS/CSS minification and aggregation, sprites computation, server/browser cache with eviction on any changes, etc. The dialect helps Thymeleaf users use WUIC features when writing their templates.

Data Attribute Dialect

by Max Bruchmann

https://github.com/mxab/thymeleaf-extras-data-attribute

Thymeleaf Data Attributes dialect evaluates thymeleaf expressions in data:* attributes and sets the result as data-* attribute of the HTML tag.

Thymeleaf Spring Data Dialect

by Javier Pena

https://github.com/jpenren/thymeleaf-spring-data-dialect

This dialect uses the Spring Data pagination elements to create pagination and sorting components in the Bootstrap style.

Thymeleaf Shiro Dialect

by Thebora Kompanioni

https://github.com/theborakompanioni/thymeleaf-extras-shiro

A Thymeleaf dialect for Apache Shiro tags.

Community Integrations

Thymeleaf integrations for MVC 1.0 (JSR371)

by Tamás Pálfalvi

https://github.com/inbuss/thymeleaf-mvc
https://github.com/inbuss/thymeleaf-cdi
https://github.com/inbuss/thymeleaf-jersey

An extension providing Thymeleaf as a view engine in JavaEE MVC 1.0 (JSR371) environments. Includes CDI integration that exposes named beans to expressions, and extends the Thymeleaf Conversion Service using the JAX-RS ParamConverter facility (on Jersey only); these functions are also available as separate extensions for use in non-MVC environments.

HDIV + Thymeleaf

by The HDIV Project

https://www.hdiv.org

HDIV is a web application security framework that helps to avoid most common web security risks (OWASP top ten). HDIV controls the data flow between the server and the client side, applying security validations transparently and without updating applications source code.

HDIV applies integrity checks (avoiding for instance parameter tampering and URLs manipulation) to all the data that is sent to the client from the server and generic input validations to the data that come from text fields. In addition to that HDIV adds aleatory tokens to each link and form in order to avoid CSRF web risk.

Thymeleaf module for Play Framework 1.2

by Satoshi Takata

https://github.com/choreo/play-thymeleaf

This module allows you to use Thymeleaf as a substitute for the Groovy templates in the view layer of Play Framework 1.2.

Thymeleaf module for Play Framework 2 (Scala)

by Dmitry Avershin

https://github.com/dmitraver/scala-play-thymeleaf-plugin

A module for Play Framework (Scala) to use Thymeleaf template engine as an alternative to Twirl, which is a standard Play Framework template engine.

Community Tools

Bootify.io

https://bootify.io/

Bootify.io is a code generator for Spring Boot. Three options can be selected for the frontend - all based on Thymeleaf, together with an optional Webpack, Bootstrap or Tailwind CSS. The user gets a customized Spring Boot app in the latest version, with Thymeleaf setup including plugins, live reload of Thymeleaf templates during development and a CRUD frontend.

Thymol

by Jim Benson

https://www.thymoljs.org/

Thymol is a useful JavaScript library that allows developers to apply their th:include/th:replace fragment inclusions statically (without executing the application).

Additionally, it provides a lot of powerful features for static prototyping like allowing developers to statically evaluate conditional fragments (th:if/th:unless) on their prototypes, improving the experience of Natural Template development.

thymeleaf-fragment.js

by Black Pepper Software

https://github.com/BlackPepperSoftware/thymeleaf-fragment.js

thymeleaf-fragment.js provides a simple script that only processes th:include, th:insert and th:replace attributes using jQuery. This allows natural templates that use fragments to be viewed in the browser as static prototypes.

Thymus

by Will Hoover

https://ugate.github.io/thymus

thymus.js is a Thymeleaf inspired JQuery plug-in that can be used as a Thymeleaf client-side controller for fragmented model/view updates via the client's browser. thymus.js is flexible enough to be run independent of Thymeleaf, but can also be used as a powerful production companion to Thymeleaf and/or as an offline protoyping engine.

Spring MVC Quickstart Maven Archetype

by Rafał Borowiec

https://github.com/kolorobot/spring-mvc-quickstart-archetype

A maven archetype for web applications including Thymeleaf, Spring MVC, Spring Security, Bootstrap, JPA (Hibernate / HSQLDB / Spring Data JPA), mongoDB and JUnit.

Thymeleaf + Spring MVC Maven Archetype

by Álex Soto

http://www.lordofthejars.com/2012/01/once-upon-time-and-long-ago-i-heard.html

A maven archetype for bootstrapping web applications using Spring MVC and Thymeleaf.

Thymesheet

by Adam Perry

https://connect-group.github.io/thymesheet/

Thymesheet is an extension for Thymeleaf which allows you to move attributes such as th:if, th:text etc, into an external CSS3 file. This means that absolutely no Java/server logic is embedded in the HTML at all - taking natural templating one step further! Compatible with Tiles, Spring, Conditional Comments, and any Thymeleaf dialect.

Thymeleaf JAWR Extension

by Danny Trunk

https://github.com/dtrunk90/thymeleaf-jawr-extension

A dialect for Thymeleaf template engine enabling the use of Jawr (a tunable packaging solution for Javascript and CSS which allows for rapid development of resources in separate module files).

Demos

SQL dialect and standalone servlet

by José Samper

https://github.com/jmiguelsamper/thymeleaf-extras-sqldialect

This example web application introduces a way of doing PHP-like web pages using Thymeleaf with zero Java code. For that, a new SQL dialect and a servlet for standalone execution of templates are introduced.