thymeleaf
控制层
实体类
thymeleaf语法 加th注意蓝色指针的地方不能错 下面内容对应控制层
资源文件:application.properties 对应好
依赖:
<dependencies>
<!-- spring mvc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 解除html语法严紧问题 -->
<dependency>
<groupId>nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.6.2</version>
</dependency>
<!-- 小辣椒 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
重要
学习文档
https://blog.csdn.net/zrk1000/article/details/72667478
th:each循环
控制层
接口
实体类
资源文件
html
包含重要
要俩个html对应才能包含
<div th:fragment="myheader">
新闻 视频 图片 军事 体育 NBA
</div><这里内容是一个html>
<这里内容也是一个html>
<div th:include="header :: myheader"></div>
all:移除所有<br/>
body:不移除自己,但移除他的子标签<br/>
tag: 只移除自己,不移除他的子标签<br/>
all-but-first:移除所有内容除第一个外<br/>
none:啥都不做<br/>
th:fragment=“myheader”
th:include=“header :: myheader”
上面红色代码俩个是对应的
include是包含header.html的内容
语法省略 .html