⒈定义片段

  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. MySQL会发生死锁吗?

    SHOW ENGINE INNODB STATUS;来查看死锁日志: SHOW PROCESSLIST;查看进程 MySQL的InnoDB引擎事务有4种隔离级别,主要是为了保证数据的一致性. Inno ...

  2. social-auth-app-django集成第三方登录

    GitHub:https://github.com/python-social-auth/social-app-django 官网文档:http://python-social-auth.readth ...

  3. 1053. Path of Equal Weight (30)

    Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of ...

  4. Windows Dll Injection、Process Injection、API Hook、DLL后门/恶意程序入侵技术

    catalogue 1. 引言2. 使用注册表注入DLL3. 使用Windows挂钩来注入DLL4. 使用远程线程来注入DLL5. 使用木马DLL来注入DLL6. 把DLL作为调试器来注入7. 使用c ...

  5. 设计模式---数据结构模式之迭代器模式(Iterate)

    一:概念 迭代模式是行为模式之一,它把对容器中包含的内部对象的访问委让给外部类,使用Iterator(遍历)按顺序进行遍历访问的设计模式. 在应用Iterator模式之前,首先应该明白Iterator ...

  6. request模块的使用

    安装方式 $ pip install requests 基本GET请求(headers参数 和 parmas参数) 1. 最基本的GET请求可以直接用get方法 response = requests ...

  7. Kafka技术内幕 读书笔记之(五) 协调者——延迟的加入组操作

      协调者处理不同消费者的“加入组请求”,由于不能立即返回“加入组响应”给每个消费者,它会创建一个“延迟操作”,表示协调者会延迟发送“加入组响应”给消费者 . 但协调者不会为每个消费者的 “加入组请求 ...

  8. Hadoop记录-hadoop和hbase监控有那些比较好的工具

    New Relic hadoop  jmx granfa falcon Ganglia,Nagios和Chukwa 自带监控软件 hadoop yarn 开启jmx监控 打开{hadoop_home} ...

  9. android studio导出apk

    在android studio导出的apk分为4种,一种是未签名调试版apk,一种是未签名发行版apk,一种是已签名调试版apk,还有一种是已签名发行版apk.以下将介绍这4种apk如何导出. 一.调 ...

  10. Enum入门【原】

    package com.bobo.www.cxf.impl; public enum Traffic { Red(1), Green(2), Yellow(3);//必须最前面 private int ...