org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
org.springframework.boot
spring-boot-configuration-processor
true
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-thymeleaf
2.controller
@Controller
public class ViewTestController {
@GetMapping("/view")
public String getViewThymeleaf(Model model){
model.addAttribute("msg","您好");
model.addAttribute("link","http://www.baidu.com");
System.out.println(model.getAttribute("msg"));
System.out.println(model.getAttribute("link"));
return "success";
}
}
3.templates
建议先了解SpringBoot静态资源和动态资源目录
Title
原本显示
百度1
百度2
th:text="${属性}":语法规则,获取model中属性存储的文本
th:href="${属性}":语法规则,获取model中属性存储的链接
4.web展示结果



