上一篇确定了一个基本的学习路线,现在看看
- 怎么把URL映射到HTML页面
怎么创建分布页
在SpringBoot里要想解析页面文件映射,必须添加模板引擎的引用,这里使用SpringBoot官方推荐的Thymeleaf。
添加Maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>
然后在项目的main- resources- templates文件夹中添加两个html文件做测试
- GoABC用来测试无参调用
- Thypage用来测试带参调用
注意把html文件中节点html替换成这样
<html xmlns:th="http://www.thyme