抽取公共内容---thymeleaf

声明重复片段
<!--引用时要在名称id前加上 # -->
<head id="commonheader">

<footer th:fragment="commonscript">
 &copy; 2011 The Good Thymes Virtual Grocery
</footer>
引用重复片段
<div th:instert="comon :: commonscript"></div>

<div th:replace="comon :: commonscript"></div>

<div th:include="comon :: commonscript"></div>

instert:在当前标签中加入重复片段中包含标签的文本内容

<div>
  <footer>
   &copy; 2011 The Good Thymes Virtual Grocery
  </footer>
</div>

replace:将当前标签替换为重复片段中包含标签的文本内容

 <footer>
   &copy; 2011 The Good Thymes Virtual Grocery
  </footer>

include:在当前标签中加入重复片段中不包含标签的文本内容

 <div>
   &copy; 2011 The Good Thymes Virtual Grocery
  </div>
上一篇:[笔记]《Effective C++》第二章


下一篇:c++——抽象类的纯虚析构函数