Introduction to Thymeleaf
Thyme
• Thyme (/taɪm/) is an aromatic
perennial evergreen herb with
culinary, medicinal, and
ornamental uses. (Wikipedia)
• Egyptians used thyme for
embalming.
• Greeks believed thyme was a
source of courage
Thymeleaf
• Thymeleaf is a Java Template Engine
• Open Source Project Released in 2011
• Created by Spanish Software Engineer Daniel
Fernandez
• Using Apache License 2.0 Open Source License
• Pronounced /‘taim/ - (time)
Thymeleaf Features
• Thymeleaf is a Java template engine producing XML, XHTML, and
HTML5.
• Thymeleaf is a replacement for JSPs (Java Server Pages)
• Thymeleaf is a ‘Natural’ Template Engine.
• Is not tied to web environment. (ie can be used for producing HTML
for emails)
• Thymeleaf is not a web framework
Thymeleaf vs JSP
• Thymeleaf templates are valid HTML documents you can view in the
browser.
• JSP files are not valid HTML, and look awful in the browser
• The natural templating ability allows you to perform rapid
development, without the need to run a container to parse the
template/JSP to view the product in a browser.
• Speeds development time
Thymeleaf Performance
• Thymeleaf typically does benchmark slower than other template
engines such as JSP, Freemarker, and Velocity
• Note: Spring 5 no longer supports Velocity
• Thymeleaf 3.0 did bring significant performance improvements
• Beware of old benchmark data!