一、应用Maven依赖

https://mvnrepository.com/中搜索Thymeleaf,找到最多人使用的版本,将其Maven依赖复制到pom.xml中

使用Thymeleaf所需的配置

 Maven依赖如下所示:

<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf</artifactId>
    <version>3.0.9.RELEASE</version>
</dependency>

 

二、在HTML页面中增加头文件

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

 

相关文章: