Thymeleafのth:includeとth:replaceの差
Thymeleafのth:includeとth:replaceは両方とも外部ファイルの内容を持ってくるタグだが、th:includeはタグの中身のみ置換するのに対して、th:replaceはタグごと置換する。
http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf_ja.html#フラグメントの定義と参照
よって、th:includeだとタグのattributeはとってこれない
上のページの先の例を使用すると以下のようになる。
<footer th:fragment="copy" class="last"> © 2011 The Good Thymes Virtual Grocery </footer> <body> ... <div th:include="footer :: copy"></div> <div th:replace="footer :: copy"></div> </body>
↓
<body> ... <div> © 2011 The Good Thymes Virtual Grocery </div> <footer class="last"> © 2011 The Good Thymes Virtual Grocery </footer> </body>