springboot如何修改thymeleaf中默认的页面路径及默认的后缀名呢?
下文讲述springboot修改thymefleaf修改页面默认路径及后缀名的方法分享,如下所示:
controller中编写相关信息
实现思路:
只需在配置文件中修改相应的配置即可,如:
application.yaml
spring:
thymeleaf:
prefix: classpath:/templates/ThymeLeaf/
suffix: .html
指定thymeleaf模板的默认位置为: /templates/ThymeLeaf/
模板的后缀名为“.html”
例:controller中编写相关信息
@Controller
public class TestController {
@RequestMapping("/index")
public String test(Model m)
{
m.addAttribute("msg","adeal love java265.com");
return "index";
}
}
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


