⒈定义片段

  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. 跨域、curl、snoopy、file_get_contents()

    定义:可以称为”信息采集/模拟登录”技术,可以实现对某个地址做请求,同时按照要求传递get或post参数. curl本身是php的一个扩展,同时也是一个利用URL语法规定来传输文件和数据的工具,支持很 ...

  2. M1-Flask-Day4

    今日内容概要: 1.git使用 2.redis基本操作 3.celery应用 4.在flask中使用celery 5.saltstack的基本使用 基础回顾: 1.关于FLASK -基本使用 路由 视 ...

  3. MySQL双主+keeplived安装部署说明

    MySQL双主+keeplived安装部署说明 一.环境介绍 1.1.规划 序号 类别 版本 主机名 IP 端口 备注 1 OS CentOS release 6.9 (Final) (minimal ...

  4. netty的对象传输

    pom <!-- https://mvnrepository.com/artifact/io.netty/netty-all --> <dependency> <grou ...

  5. 流媒体技术学习笔记之(十八)Ubuntu 16.04.3 如何编译 FFmpeg 记录

    官方文档:https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu 一.最简单安装: apt-get install ffmpeg 二.安装最新版本 大 ...

  6. ArcGis辅助编号(半自动)功能的插件式实现

    应邀写了一个ArcGis(ArcMap更确切一些)的辅助编号功能,其实只要想通了实现逻辑,实现的过程蛮简单的.相比挨个儿点要素写进编号或者借助“按键精灵”写入,直接操作宿主真是爽快得不能自已.无图言屌 ...

  7. javaScript ES5常考面试题总结

    js的六种原始值 boolean null undefined number string symbol 坑1: 首先原始类型存储的都是值,是没有函数可以调用的,比如 undefined.toStri ...

  8. vue中axios 配置请求拦截功能 及请求方式如何封装

    main.js 中: import axios from '................/axios' axios.js 中: //axios.js import Vue from 'vue' i ...

  9. 26. SpringBoot 初识缓存及 SimpleCacheConfiguration源码解析

    1.引入一下starter: web.cache.Mybatis.MySQL @MapperScan("com.everjiankang.cache.dao") @SpringBo ...

  10. mysql字符函数

    1.CONCAT()  字符连接 (1)mysql> SELECT CONCAT('imooc', 'MYSQL');+--------------------------+| CONCAT(' ...