thymeleaf可以使用th:include标签进行其他页面模块的导入,这个效果和jsp:include效果相似,都可以导入其他内容不必重复书写。
被导入模块index.html:
<div th:fragment="head">
</div>
在其它页面导入index.html中的head模块:
<div th:include="index::head"></div>
本文介绍Thymeleaf中使用th:include标签导入其他页面模块的方法,类似于JSP的jsp:include,实现代码复用。
thymeleaf可以使用th:include标签进行其他页面模块的导入,这个效果和jsp:include效果相似,都可以导入其他内容不必重复书写。
被导入模块index.html:
<div th:fragment="head">
</div>
在其它页面导入index.html中的head模块:
<div th:include="index::head"></div>

被折叠的 条评论
为什么被折叠?