相关疑难解决方法(0)

Thymeleaf布局方言和th:替换头部导致标题为空白

我正在学习本教程:http://www.thymeleaf.org/doc/layouts.html(获得Thymeleaf布局方言部分).在那里你可以找到一个例子:

<!DOCTYPE html>
<html>
  <head>
  <!--/*  Each token will be replaced by their respective titles in the resulting page. */-->
    <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">Task List</title>
    ...
  </head>
  <body>
    <!--/* Standard layout can be mixed with Layout Dialect */-->
    <div th:replace="fragments/header :: header">
    ...
    </div>
    <div class="container">
      <div layout:fragment="content">
      ...
      </div>
      <div th:replace="fragments/footer :: footer">&copy; 2014 The Static Templates</div>
    </div>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

th:replace在上面的示例中,页脚和标题被标记替换,而在布局文件中<head><title>标记.

基本上,我想用整个<head>标签替换th:replace.因此,我有:

我的布局文件:

<!DOCTYPE html>
<html> …
Run Code Online (Sandbox Code Playgroud)

layout dialect thymeleaf

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

dialect ×1

layout ×1

thymeleaf ×1