1. thymeleaf的版本适配


3.0.9.RELASE
2.1.1

org.springframework.boot
spring-boot-starter-thymeleaf

2. 2种返回方式

2.1 “/hello”直接返回浏览器
2.2 “/success”是通过thymeleaf渲染的方式

image.png

3. 使用1: 查出一些数据在页面展示

导入thymeleaf名称空间

  1. <html lang="en" xmlns:th="http://www.thymeleaf.org">
map.put("hello", "你好!");


<div th:text="${hello}"> </div>

4. th语法

image.png


5. springMVC web的注入过程:

Spring Boot.md

6. @pathVariable

@GetMapping("/emp/{id}")
    public String toEditPage(@PathVariable("id") Integer id,Model model){}