Thymeleaf布局不起作用

时间:2018-04-20 17:39:41

标签: spring-boot thymeleaf

我有这样的布局:

...
class User extends Authenticatable
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'id', 'name', 'email', 'password',
    ];
...

我正在尝试将它用于我的索引页面,如下所示:

<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"/>


    <link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
<title layout:title-patern="$LAYOUT_TITLE - $CONTENT_TITLE">System</title>
</head>
<body>
    <th:block th:replace="fragments/header :: header"/>
    <div class="container">
        <th:block layout:fragment="content"/>
    </div>
    <th:block th:replace="fragments/footer :: footer"/>
</body>
</html>

但它只是没有工作,索引页面不使用bootstrap和css文件,页脚和标题也没有。 我使用百里香 - 布局 - 方言2.2.2 我错过了什么?

1 个答案:

答案 0 :(得分:0)

通过添加

解决了这个问题
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>

到属性

下的pom.xml文件
相关问题