SpringBoot推荐的Thymeleaf

1.引入依赖

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

2.切换thymeleaf版本


        3.0.9.RELEASE
        
        
        2.2.2
  

3.Thymeleaf使用

只要我们把HTML页面放在classpath:/templates/,thymeleaf就能自动渲染;

①导入thymeleaf的名称空间

"en" xmlns:th="http://www.thymeleaf.org">

4.语法规则

th:text;改变当前元素里面的文本内容

th:任意html属性;来替换原生属性的值

SpringBoot推荐的Thymeleaf_第1张图片

 

你可能感兴趣的:(SpringBoot推荐的Thymeleaf)