其他分享
首页 > 其他分享> > 使用thymeleaf的include或者是replace报错,但不使用一切正常时的解决方法之一

使用thymeleaf的include或者是replace报错,但不使用一切正常时的解决方法之一

作者:互联网

如果错误是类似

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "usersmanger", template might not exist or might not be accessible by any of the configured Template Resolvers (template: "x/x" - line 67, col 26)

上面的x/x表示的是文件相对路径,当你使用include或replace时忘记了文件的路径。
通常情况下页面是放在templates下面,但如果你因为需求在其底下建立一个文件夹用于存放别的页面这时候就要指明到底是哪个了,它默认是到temjplates里面直接找文件名,所以得在你引进的文件加上其目录,如下

 <div th:include="~{x/x:: x}" class="hello"></div>

另外检查是否文件名是否正确。。。。。。。。

标签:replace,thymeleaf,报错,template,include,might,页面
来源: https://blog.csdn.net/weixin_43591127/article/details/112608021