首页 > 解决方案 > 如何在 tymeleaf 布局装饰器中添加页面特定的脚本标签?

问题描述

可以说,我有以下布局页面 tmeplate.html

<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
...
<body>
   ...
   <section layout:fragment="custom-content">
     DEFAULT CONTENT GOES HERE
   </section>
   ...
</body>
</html>

我的 index.html 页面如下

<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
   layout:decorator="template">
...
<body>
  ...
  <section layout:fragment="custom-content">
      PAGE SPECIFIC CONTENT GOES HERE
  </section>
  ...
</body>
</html>

那么,如何在结束正文标记之前添加 index.html 页面特定脚本标记?

标签: spring-mvcthymeleaf

解决方案


推荐阅读