message Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template “/error/error”, template might not exist or might not be accessible by any of the configured Template Resolvers
这个报错有两种原因
第一种:return 模板的时候前面加了个斜杠 例如 :return “/web/shifthtml”,
去掉前面的斜杠 改成 return “web/shifthtml” 就好了
还有就是在配置文件加spring.thymeleaf.prefix=classpath:/templates也能解决
还有一种原因是
你的controller
如果返回值你设置的为空的话,那么就是没有返回值 所以返回不了页面。也会出现这个错误,
解决方法: 在方法上加个 @ResponseBody 注解就好了,因为你并不需要返回页面

解决Error resolving template template might not exist or might not be accessible问题
最新推荐文章于 2024-03-16 22:39:12 发布
本文探讨了Thymeleaf框架中常见的模板输入异常问题,包括错误的模板路径配置和控制器返回值不当两种常见场景,并提供了具体的解决方案,如调整模板路径、正确配置前缀及使用@ResponseBody注解。
1万+

被折叠的 条评论
为什么被折叠?



