
本文最后更新于 912 天前,其中的信息可能已经有所发展或是发生改变。
<dependencies>
<!-- springboot启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- thymeleaf启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>视图文件存放的目录:src/main/resource/templates
注:该目录是安全的,意味着该目录下的内容不允许外界直接访问,防止视图文件未经过渲染就展现
<span th:text="Yuyy"></span>
<hr>
<span th:text="msg"></span> @RequestMapping("show")
public String showInfo(Model model){
model.addAttribute("msg", "hello thymeleaf");
return "index";
}由于旧版本的thymeleaf对渲染的html文件的语法要求严谨,所有标签必须具备结束标签
产生异常
处理异常

Post Views: 367