在這里,我正在嘗試使用 EventController 創建一個新頁面并與 thymeleaf 連接
@Controller
public class EventController {
@RequestMapping(value = "/pereschet", method = RequestMethod.GET)
public String welcome() {
return "boom";
}
}
這是我的html頁面boom.html
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorator="layout">
<head>
<title>Index</title>
</head>
<body>
<h1 >Boombom</h1>
</body>
</html>
當我到達 /timetracking/compensatory/boom 錯誤時,它給了我錯誤未找到錯誤決議模板“boom”,模板可能不存在或可能無法被任何配置的模板決議器訪問
我想期待作業頁面,有什么想法?
uj5u.com熱心網友回復:
thymeleaf 的默認模板目錄是 src/main/resources/templates。請確保您已將 boom.html 放置在此目錄中,因為根據您的問題沒有模板決議器。請查看我在網上找到的此鏈接,了解有關自定義模板決議器的詳細資訊。帶有 Thymeleaf 的 Spring Boot
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/452762.html
上一篇:模型中的Java反射集列舉
