thymeleaf的insert,replace,include区别以及block块级元素

  • th:insert   :保留自己的主标签,保留th:fragment的主标签。
  • th:replace :不要自己的主标签,保留th:fragment的主标签。
  • th:include :保留自己的主标签,不要th:fragment的主标签。(官方3.0后不推荐)
  • th:block</th:block>是Thymeleaf提供的唯一的一个Thymeleaf块级元素,其特殊性在于Thymeleaf模板引擎在处理th:block的时候会删掉它本身,标签本身不显示,而保留其内容

原文地址:https://www.cnblogs.com/zhangmo/p/15277143.html