1. 程式人生 > 其它 >使用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>

另外檢查是否檔名是否正確。。。。。。。。