日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板

發(fā)布時間:2025/4/16 HTML 93 豆豆
生活随笔 收集整理的這篇文章主要介紹了 没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

我正在嘗試用Thymeleaf創(chuàng)建一個基於Spring Boot的應(yīng)用程序。我使用PetClinic樣本作爲起點。 我的應(yīng)用程序找不到一些模板。Spring Boot and Thymeleaf:找不到HTML模板

我的項目是建立在標準的方式:

/src

/main

/java

/com.example

MyWebApplication.java

HomeController.java

/resources

/static

/css

/templates

/fragments

layout.html

home.html

application.properties

的pom.xml

org.springframework.boot

spring-boot-starter-parent

1.5.1.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter-thymeleaf

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-test

test

org.springframework.boot

spring-boot-devtools

true

MyWebApplication.java

@SpringBootApplication

public class MyWebApplication {

public static void main(String[] args) {

SpringApplication.run(MyWebApplication.class, args);

}

}

HomeController.java

home.html做爲

xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"

th:replace="~{fragments/layout :: layout (~{::body},'home')}">

Welcome

的layout.html

th:fragment="layout (template, menu)">

Web Interface

Toggle navigation

application.properties是空的。

當我瀏覽到http://localhost:8080我得到的錯誤:

Error resolving template "~{fragments/layout", template might not exist or might not be accessible by any of the configured Template Resolvers (home:5)

如果我刪除了「日:更換」從home.html的屬性,它會顯示歡迎信息。

瀏覽類似問題(例如this one),我看到其他人創(chuàng)建了ThymeleafViewResolver bean。

問題:

爲什麼不能找到我的模板?

我是否需要創(chuàng)建模板解析器?如果是這樣,那麼寵物診所樣本怎麼沒有?它的模板解析器來自哪裏?

據(jù)我所見,它的設(shè)置方式與寵物診所樣品一樣,那麼有什麼區(qū)別?

2017-02-03

AlanW

總結(jié)

以上是生活随笔為你收集整理的没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。