Thymeleaf has all the capabilities and even more than that of traditional JSP. In this post we will be discussing about what is Thymeleaf, why Thymeleaf is required and also about how to integrate Thymeleaf with Spring Boot with a simple example.

What is Thymeleaf

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

In web applications Thymeleaf aims to be a complete substitute for JSP, and implements the concept of Natural Templates: template files that can be directly opened in browsers and that still display correctly as web pages.

Why Thymeleaf

ThymeLeaf is a healthy open source project: new features coming up each month, good documentation, responsive user forums…

Though JSP is more or less like HTML but it is not completely compatible with HTML like Thymeleaf. Thymeleaf template file will open and display normally in a browser, while a JSP file does not.

Thymeleaf has also support for variable expressions (${...}) like Spring EL and execute on model attributes, asterisk expressions (*{...}) execute on the form backing bean, hash expressions (#{...}) are for internationalization and link expressions (@{...}) rewrite URLs.

Unlike JSPs, Thymeleaf works well for Rich HTML emails.

Spring Boot Thymeleaf Integration

Extra maven dependencies is required.





Rest of the configurations are similar to spring boot actual configurations.

Complete source code explanation for      spring boot thymeleaf example

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.