Resolving Thymeleaf views

Thymeleaf is a Java-based XML/HTML/HTML5 template engine library to build web applications. It allows faster processing of templates and increased performance due to the intelligent caching of parsed view files. Please refer to the official Thymeleaf documentation for Thymeleaf page authoring.

You need Thymeleaf and Spring (org.thymeleaf) in your Maven dependencies in order to use Thymeleaf in your projects. Thymeleaf views can be resolved in your project with the following snippet:

<beans:bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
   <beans:property name="templateEngine" ref="templateEngine" />
   <beans:property name="order" value="1" />
   <beans:property name="viewNames" value="*.html,*.xhtml" />
</beans:bean>

<beans:bean id="templateResolver" class= "org.thymeleaf.templateresolver.ServletContextTemplateResolver">
   <beans:property name="prefix" value="/WEB-INF/templates/" />
   <beans:property name="suffix" value=".html" />
   <beans:property name="templateMode" value="HTML5" />
</beans:bean>

<beans:bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
   <beans:property name="templateResolver" ref="templateResolver" />
</beans:bean>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset