⒈定义片段

  1.使用th:fragment   

     <div th:fragment="copy">
&copy; 2019 <a href="http://www.coreqi.cn">Coreqi</a>
</div>

  2.不使用th:fragment 

     <div id="copy-section">
&copy; 2019 <a href="http://www.coreqi.cn">Coreqi</a>
</div>

⒉引用片段

  1.引用使用th:fragment的片段

     <div th:insert="~{footer :: copy}"></div>

  2.引用不使用th:fragment的片段

     <div th:insert="~{footer :: #copy-section}"></div>

⒊引用模板使用的th:insert、th:replace、th:include三者之间的区别

  • th:insert  将简单地插入指定的片段作为正文的主标签
  • th:replace      用指定实际片段来替换其主标签
  • th:include        类似于th:insert,但不是插入片段,而是只插入此片段的内容(3.x版本后不再推荐使用)

Thymeleaf模板布局的更多相关文章

  1. thymeleaf 模板布局

    八.模板布局(Template Layout) 8.1 包含模板片段(Including template fragments) 定义和引用片段 我们通常想要从别的模板文件中调用一些模板片段,例如 页 ...

  2. Thymeleaf 模板布局三种区别

  3. Thymeleaf 模板

    Thymeleaf 模板布局 th:fragment.th:replace.th:insert.th:remove th:fragment  模板布局 模板片段说明 模板中,经常希望从其他模板中包含⼀ ...

  4. Springboot 使用thymeleaf模板layout布局

    使用layout布局前应该在pom文件中导入thymeleaf(dialect)依赖:如下 <properties> <project.build.sourceEncoding> ...

  5. (八)Thymeleaf的 th:* 属性之—— 模板布局& th:with& 属性优先级

    3.7 模板布局 模板名称:layout.html 3.7.1 th:fragment e.g.模板名为footer.html页面body部分如下: <body> <div th:f ...

  6. Thymeleaf模板的使用

    使用模板的要点:     页面主体结构固定,具体参数可变,尽可能让参数动态化,才能提高模板的复用性 ================================================== ...

  7. thymeleaf模板的使用(转)

    作者:纯洁的微笑 出处:http://www.ityouknow.com/ 在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thym ...

  8. Java 前端模板引擎学习:thymeleaf 模板引擎

    模板引擎接口 ITemplateEngine 一.后台数据与外部数据 1.处理后台数据 $表达式是个变量表达式,用于处理在  request parameters and the request, s ...

  9. 4.3 thymeleaf模板引擎的使用

    参考说明:以下笔记参考来自尚硅谷springboot教学中的笔记! thymeleaf官网docs: https://www.thymeleaf.org/documentation.html 模板引擎 ...

随机推荐

  1. python中执行shell命令的几个方法小结

    原文 http://www.jb51.net/article/55327.htm 最近有个需求就是页面上执行shell命令,第一想到的就是os.system, os.system('cat /proc ...

  2. 2017-12-15python全栈9期第二天第七节之x or y ,x 为 非 0时,则返回x

    #!/user/bin/python# -*- coding:utf-8 -*-# x or y ,x 为 非 0时,则返回xprint(1 or 2)print(3 or 2)print(0 or ...

  3. 集成学习算法汇总----Boosting和Bagging(推荐AAA)

     sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003& ...

  4. Hbase学习04

    3.2.4 反向时间戳 反向扫描API HBASE-4811(https://issues.apache.org/jira/browse/HBASE-4811)实现了一个API来扫描一个表或范围内的一 ...

  5. 队列 Queue 与 生产者消费模型

    队列:先进先出 # from multiprocessing import Queue # Q = Queue(4) # Q.put('a') # Q.put('b') # Q.put('b') # ...

  6. 056、macvlan网络结构分析(2019-03-25 周一)

    参考https://www.cnblogs.com/CloudMan6/p/7383919.html   macvlan不依赖linux bridge   brctl show 可以确认没有创建新的b ...

  7. Burpsuite之Burp Collaborator模块介绍

    Burp Collaborator.是从Burp suite v1.6.15版本添加的新功能,它几乎是一种全新的渗透测试方法.Burp Collaborator.会渐渐支持blind XSS,SSRF ...

  8. mysql5.7安装(正确安装)实战

    一.二进制免编译包安装  参考:http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10105&highlight=mys ...

  9. PHP连接数据库实现多条件查询与分页功能——关于租房页面的完整实例操作

    租房页面如图: 代码如下: <!DOCTYPE html><html>    <head>        <meta charset="UTF-8& ...

  10. Matconvnet环境配置一些坑

    1.先安装VS再安装matlab否则安装失败 2.cuda7.5支持MATLABR2016a/b,支持VS2013但是不支持VS2015 3.cuda8.0支持MABTLABR2017a,对应编译需V ...