首页 > 其他 > 详细

thymeleaf 无法正常解析页面(本地可以正常访问某个请求,并可以返回页面,但服务端访问出现找不到模板)

时间:2020-04-10 11:43:46      阅读:210      评论:0      收藏:0      [点我收藏+]

thymeleaf 无法正常解析页面(本地可以正常访问某个请求,并可以返回页面,但服务端访问出现找不到模板)

出错提示:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/admin/index], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause

解决方案:

之前的:

modelAndView.setViewName("/admin/index");

应该改成

modelAndView.setViewName("admin/index");

去掉/就可以正常路由了。

thymeleaf 无法正常解析页面(本地可以正常访问某个请求,并可以返回页面,但服务端访问出现找不到模板)

原文:https://www.cnblogs.com/chenyameng/p/12672261.html

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