抽取公共内容---thymeleaf
作者:互联网
声明重复片段
<!--引用时要在名称id前加上 # -->
<head id="commonheader">
<footer th:fragment="commonscript">
© 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>
© 2011 The Good Thymes Virtual Grocery
</footer>
</div>
replace:将当前标签替换为重复片段中包含标签的文本内容
<footer>
© 2011 The Good Thymes Virtual Grocery
</footer>
include:在当前标签中加入重复片段中不包含标签的文本内容
<div>
© 2011 The Good Thymes Virtual Grocery
</div>
标签:片段,抽取,标签,Grocery,Virtual,---,thymeleaf,Good,2011 来源: https://www.cnblogs.com/chao-s/p/15169858.html