Thymeleaf 模板的使用--注意事项
来源:互联网 发布:java long 最大长度 编辑:程序博客网 时间:2024/05/17 21:56
##起
为了把页面中的公共部分抽离出来,果断用起thymeleaf的模版功能。
参考了下这篇文章http://www.jianshu.com/p/ed9d47f92e37。
承
th:fragment如何定义
起初老是有几个css属性没有加载进来,后来试着直接把公共片段贴进来,发现又是可以的。然后就仔细比对前后两者差异,发现少了一层div,细查原来是“th:fragment”加错位置了。
<div th:fragment="userbar" class="class1"> <div class="... ... ..."> </div></div>
类似如下,标签应该把想引入的公共部分包裹起来,否则像上述中“class1”之类是不会有效果的。
th:fragment如何被引入
fragment的引入只是引入了代码,类似于代码粘贴。也就是说fragment所处文件中引入的css和js script不会被引入。则css和js script需要在调用发起的文件中被定义。
th:if
在判断boolean类型时,eclipse默认的getter生成方法isBool(),thymeleaf是无法识别的,需要改成getBool()方可。
<a th:if="${cabinet.isOnline}" style="cursor: default" class="btn green"> 上线 </a>
结
刚刚开始使用thymeleaf,加油!
0 0
- Thymeleaf 模板的使用--注意事项
- Thymeleaf模板的使用
- Thymeleaf模板的使用
- Thymeleaf模板的使用
- Thymeleaf模板的使用
- Thymeleaf 模板的使用
- Thymeleaf模板的使用
- Thymeleaf 模板的使用
- thymeleaf模板的使用
- thymeleaf模板引擎的使用
- thymeleaf页面框架模板的使用
- 使用thymeleaf模板出现的问题
- spring-boot--使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- Spring Boot使用thymeleaf模板
- SpringBoot使用thymeleaf模板引擎
- spring-boot--使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- JSP的中文乱码问题
- Linux Centos7下MySQL数据库的安装教程
- 卷积神经网络(CNN)反向传播算法
- 数据集质量提升方法及代码实现
- 地基双目视觉与扩展卡尔曼滤波在无人机起降引导中的应用
- Thymeleaf 模板的使用--注意事项
- linux常用命令
- HDU 1754(线段树点修改模板题)
- 170306
- XMLHTTP中setRequestHeader参数问题
- 进程
- Java----Socket编程之模拟客户端Client
- 哈工大操作系统实验 5 地址映射与共享
- HTML5 time元素