- 添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2.例子
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 th:text="${hello}" >haha</h1>
<a href="www.baidu.com" th:href="@{www}">百度</a>
</body>
</html>
3.后台
@Controller
@RequestMapping("jump")
public String jumpTo(Model model)
{
model.addAttribute("hello","world!");
model.addAttribute("www","www.baidu.com");
return "success";
}
4 语法就不记录了 网上很多