【发布时间】:2015-09-14 11:19:44
【问题描述】:
我有一个 Spring Boot 应用程序,我在 pom.xml 中使用这些行定义我的 thymeleaf 依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
所以当我启动应用程序并打印预定义的 bean 名称时,我会看到这些 bean(我认为这对于 thymeleaf 正常运行很重要):
- 模板引擎
- thymeleafResourceResolver
- thymeleafViewResolver
项目结构如下:
我在fragments.html中定义了一些片段:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<body>
<div class="container" th:fragment="copy">
<hr>
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Teamtool 2015</p>
</div>
</div>
</footer>
</div>
</body>
</html>
.. 我正在尝试像这样使用我的 index.html 中的那些:
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Hello AngularJS</title>
<base href="/" />
<link href="css/angular-bootstrap.css" rel="stylesheet">
<style type="text/css">
[ng\:cloak], [ng-cloak], .ng-cloak {
display: none !important;
}
</style>
</head>
<body ng-app="hello" ng-cloak class="ng-cloak">
<div ng-controller="navigation" class="container">
<ul class="nav nav-pills" role="tablist">
<li ng-class="{active:tab('home')}"><a href="/">home</a></li>
...
</ul>
</div>
<div ng-view class="container"></div>
<div class="col-md-3" th:include="fragments :: copy"></div>
<script src="js/angular-bootstrap.js" type="text/javascript"></script>
...
</body>
</html>
但是我的模板没有添加到 index.html 中。我做错了什么?
【问题讨论】:
标签: spring spring-boot thymeleaf