首页 > 编程语言 > 详细

Springboot项目打包后的页面丢失问题(thymeleaf报错)

时间:2019-04-27 15:22:09      阅读:473      评论:0      收藏:0      [点我收藏+]

遇到的问题目前找到两种:

  • 返回视图路径以/开头,例如 /test/hello
  • 在thymeleaf页面中,引入的页面以/开头,例如:<footer th:replace="/index::footer"></footer>
代码书写规范:
    @GetMapping("/about-us")
    public String sysInfo(){
        return "students/about-us";
    }

错误写法:(不要在前面加入"/")

return "/students/about-us";

引入公共模板时,也不要加‘‘/‘

正确写法:

<header th:replace="main/sys-public :: stu-header"></header>

总结:在代码编写的过程中,要注意规范书写习惯,避免不必要的问题发生。



Springboot项目打包后的页面丢失问题(thymeleaf报错)

原文:https://www.cnblogs.com/116970u/p/10778741.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!