The use of view technologies in Spring MVC is pluggable. Whether you decide to use Thymeleaf, Groovy markup templates, JSP, or other technologies, it all basically comes down to configuration changes. This chapter describes the presentation technologies integrated into Spring MVC. We'll assume you're already familiar with view resolution.

Spring MVC application views operate within the internal trust boundaries of that application. Views have access to all of your application's context beans. Therefore, it is not recommended to use Spring MVC template support in applications where templates can be edited by external sources, as this may have security implications.

Thymeleaf

Thymeleaf is a modern server-side Java templating engine that emphasizes natural HTML templates that can be previewed in the browser with a double-click, which is very convenient when working on UI templates yourself (for example, as a designer) without the need for a running server. If JSP pages need to be replaced, Thymeleaf provides one of the most extensive feature sets to facilitate such conversion. Thymeleaf is actively developed and maintained. More complete introductory information can be found on the project home page Thymeleaf.

Thymeleaf's integration with Spring MVC is managed by the Thymeleaf project. The configuration consists of several bean declarations such as ServletContextTemplateResolver, SpringTemplateEngine and ThymeleafViewResolver. For more information, see "Thymeleaf+Spring".