Spring boot 视图解析与模板引擎
spring boot 默认不支持 jsp
需要引用第三方模板引擎技术实现页面渲染
第三方模板引擎 thymeleaf
thymeleaf 官方文档
https://www.thymeleaf.org/
首先使用 thymeleaf 先引入 依赖
org.springframework.boot
spring-boot-starter-thymeleaf
一般如果是高并发情况 不建议使用 thymeleaf
如果是单体项目 可以使用thymeleaf
页面默认存放位置 在 classpath:/templates/ 文件夹下
就是 resources 文件夹下的 templates
html 文件存放位置

通过控制器 来进行动态渲染 页面数据

模板引擎的数据渲染 基本写法
th:text=“${xxx}” 表示渲染的是 文本
th:href=“${xxx}” 表示渲染的是 是一个超链接
这种渲染 一般是去外部网站链接
比如 从你网站跳转到百度
th:href=“@{xxx}” 表示渲染的也是一个超联集
这种渲染 是 自己网站内部的跳转方式
比如从这个页面跳转到 另一个页面
$ 和 @ 是有区别的

给路径追加前缀
只需要在配置文件中加上
server.servlet.context-path=/json
