一、依赖提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
依赖`
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
`
要3.0版本以上的
二、使用步骤 1.引入库依赖`
org.springframework.boot spring-boot-starter-thymeleaf ` org.springframework.boot spring-boot-starter-web
要3.0版本以上的
默认在templates文件夹下.html文件
引入
3.后端
@Controller
public class IndexController {
@RequestMapping("/index")
public String index(Model model){
model.addAttribute("msg","hello");
return "index";
}
}
在这里插入图片描述



