th:include 和 th:replace 都可以引入模块,两者的区别在于:
- th:include:引入子模块的 children,依然保留父模块的 tag
- th:replace:引入子模块的所有,不保留父模块的 tag
- <footer th:fragment="copy">
- © 2018 Copyright by holyong.
- </footer>
- <body>
- ...
- <div th:include="footer :: copy"></div>
- <div th:replace="footer :: copy"></div>
- </body>
- <body>
- ...
- <div>
- © 2018 Copyright by holyong.
- </div>
- <footer>
- © 2018 Copyright by holyong.
- </footer>
- </body>