Springboot 使用thymeleaf模板layout布局
使用layout布局前应该在pom文件中导入thymeleaf(dialect)依赖:如下
<properties>
<project.build.sourceEncoding>UTF-</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<thymeleaf.version>3.0..RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.0.</thymeleaf-layout-dialect.version>
</properties>
注意:
2.0以前是可以这样写的,但是在2.0项目的jar包中,没有thymeleaf-layout-dialect这个jar包,需要在pom文件中引入:
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.2.</version>
</dependency>
thymeleaf模板:


展示效果:

每次只需要改变中间content内容就好了,最常见的后台布局就搭好了
Springboot 使用thymeleaf模板layout布局的更多相关文章
- Springboot整合thymeleaf模板
Thymeleaf是个XML/XHTML/HTML5模板引擎,可以用于Web与非Web应用. Thymeleaf的主要目标在于提供一种可被浏览器正确显示的.格式良好的模板创建方式,因此也可以用作静态建 ...
- SpringBoot 之Thymeleaf模板.
一.前言 Thymeleaf 的出现是为了取代 JSP,虽然 JSP 存在了很长时间,并在 Java Web 开发中无处不在,但是它也存在一些缺陷: 1.JSP 最明显的问题在于它看起来像HTML或X ...
- springboot整合Thymeleaf模板引擎
引入依赖 需要引入Spring Boot的Thymeleaf启动器依赖. <dependency> <groupId>org.springframework.boot</ ...
- SpringBoot日记——Thymeleaf模板引擎篇
开发通常我们都会使用模板引擎,比如:JSP.Velocity.Freemarker.Thymeleaf等等很多,那么模板引擎是干嘛用的? 模板引擎,顾名思义,是一款模板,模板中可以动态的写入一些参数, ...
- SpringBoot使用thymeleaf模板引擎
(1).添加pom依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactI ...
- (二)springboot整合thymeleaf模板
在我们平时的开发中,用了很久的jsp作view显示层,但是标签库和JSP缺乏良好格式的一个副作用就是它很少能够与其产生的HTML类似.所以,在Web浏览器或HTML编辑器中查看未经渲染的JSP模板是非 ...
- 【Springboot】Springboot整合Thymeleaf模板引擎
Thymeleaf Thymeleaf是跟Velocity.FreeMarker类似的模板引擎,它可以完全替代JSP,相较与其他的模板引擎,它主要有以下几个特点: 1. Thymeleaf在有网络和无 ...
- SpringBoot系列——Thymeleaf模板
前言 thymeleaf是springboot官方推荐使用的java模板引擎,在springboot的参考指南里的第28.1.10 Template Engines中介绍并推荐使用thymeleaf, ...
- springboot 引入 thymeleaf 模板
第一步pom中: <!-- 引入 thymeleaf 模板依赖 --> <dependency> <groupId>org.springframework.boot ...
随机推荐
- wakatime记录 coding时间的工具
想记录下自己每天coding 的时间以及每个在各个项目上coding的时间,之前一直也没有什么好的办法,无意之间发现wakatime这个插件可以记录自己每天有效的coding时间. wakatime ...
- laravel Cache store [] is not defined
去这个网站学习一下也好 https://laravel-china.org/topics/2093/laravel-source-analysis-series-cache#0b2791 如果env ...
- 基于嵌入式linux路由转发功能的实现
环境 arm7开发板, uclinux系统,kernel version: linux-2.4.x arm芯片的单网卡双网口设备,eth0 WAN口 ipaddr 192.168.9.61 eth0: ...
- WindowsDenfender
c:\Program Files\Windows Defender>MpCmdRun.exe -scan -scantype 3 -file "D:\手动更新病毒库" -Di ...
- Pytest高级进阶之Fixture
From: https://www.cnblogs.com/feiyi211/p/6626314.html 一. fixture介绍 fixture是pytest的一个闪光点,pytest要精通怎么能 ...
- what is MAC address
MAC Address:media access control address A media access control address (MAC address) is a unique id ...
- nodejs静态web服务
项目准备 Web 服务器一般指网站服务器,是指驻留于因特网上某种类型计算机的程序,可以向浏览器等 Web 客户端提供文档,也可以放置网站文件,让全世界浏览:可以放置数据文件,让全世界下载.目前最主流的 ...
- 廖雪峰Java8JUnit单元测试-2使用JUnit-3参数化测试
参数化测试: 可以把测试数据组织起来 用不同的测试数据调用相同的测试方法
- web页面性能
一.资源压缩合并,减少HTTP请求 二.非核心代码异步加载 1.异步加载的方式 动态脚本加载 defer async 2.异步加载的区别 (1)defer是在HTML解析完之后才会执行,如果是多个,按 ...
- C:指针遍历二维数组
C 指针遍历二维数组 http://blog.csdn.net/lcxandsfy/article/details/55000033 C++ 字符串指针与字符串数组 https://www.cnblo ...