在使用spring boot搭建项目的时候报错:
Error resolving template template might not exist or might not be accessible
解决方法:
情况1:
public String thymeleaf(Model model){ model.addAttribute("name", "mark"); return "hello "; }
仔细观察后发现:
"hello "中多了一个空格..改成“hello”即OK。
情况2:
public String thymeleaf(Model model){ model.addAttribute("name", "mark"); return "/hello"; }
在springboot中使用thymeleaf不需要加“/xxxx”
同样的改成:
public String thymeleaf(Model model){ model.addAttribute("name", "mark"); return "hello"; }
就OK