1. 程式人生 > >springboot + thymeleaf 錯誤

springboot + thymeleaf 錯誤

在使用springboot + thymeleaf的時候有些問題。記錄一下

1.springboot 引入thymeleaf的依賴。引入spring-boot-starter-thymeleaf。這裡最好重新整理一下maven projects,引入thymele的依賴,pom中引入不報錯了,但是,這裡邊沒有顯示引入的話,也是不行的,出現問題是:(我直接把介面拷貝過來了)

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Nov 19 11:59:33 CST 2018

There was an unexpected error (type=Internal Server Error, status=500).

Circular view path [index]: would dispatch back to the current handler URL [/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

 

2.org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers

這個錯誤,說模板不存在,好吧。我目錄下也有檔案啊,模板沒有引入? 錯了。自己建立的介面需要在templates資料夾。不然就會出現上述的問題。

好像是第二次出現這個問題了,記錄一下吧。

3.開啟的頁面中載入的js 不存在。好吧,開啟的話,能直接通過Ctrl + 左鍵 點選到地址,但是還是錯誤的。這裡需要把檔案(css,js)放到resources資原始檔夾下的static資料夾下