和属性文件中thymeleaf模板的配置相关

1、配置信息

spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.content-type=text/html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
spring.thymeleaf.cache-period=0
spring.template.cache=false

2、在spring mvc 的 controller中

@RequestMapping("/home")
public String home(Model model, HttpServletRequest req) {
  model.addAttribute("access_token", req.getParameter("access_token"));
   return "home";
}

 

3、配置 + controller中必须为:

classpath:/templates/home   //classpath路径下的 templates包 下的 home.html文件

 

 

相关文章:

  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2022-03-07
  • 2021-11-28
猜你喜欢
  • 2021-05-16
  • 2021-10-27
  • 2021-07-19
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案