Thymleaf(工作笔记本)
 1,循环遍历
th:each="li,information:${information}"
 
2,文本
 th:text="${numberOfElements}"
 
 3,带格式的文本(编辑器中的文本)
 th:utext="${numberOfElements}"
 
 4,超链接
 th:href="@{'./information'(id=${li.infoId})}"
 
 5,图片信息(地址对的时候,地址错误的时候)
 onerror="this.src='./images/spg9.png'" 
 th:src="${li.infoImg}"
 
 6,if
 if判断(如果不为空,则显示文本为text中值
 th:if="${li.user.userName!=null}" 
 th:text="${li.user.userName}"
 
 if判断(显示排序中的6条数据)
 th:if="${infomation.index<6}" 
 th:text="${li.infomation}"
 
 if判断(显示排序中的最新一条数据)
 th:if="${infomation.index==0}" 
 th:text="${li.infomation}"
 
 if判断(显示用户名,如用户名不存在,则显示未知)
     发布人:<span th:if="${li.user.userName!=null}" th:text="${li.user.userName}"></span>
             <span th:if="${li.user.userName==null}" th:text="未知">未知</span>
 
 7,轮播中的添加class属性的设置
 th:classappend="${carouselindex.index == 0}? 'active'"
 
 8,模块分离(拆分头尾、侧边栏)
 
提取的模块:
抽取到aa.html中
th:fragment="newNavbar"
th:fragment="模块名字 "
 
模块引入:
 <div th:replace="./sss/aa:: newNavbar"></div>
  <div th:replace="抽取路径+aa:: 模板名字"></div>
 
 9,迭代遍历(侧边栏拆分显示制定条数)需要用迭代器iterStat
<tr th:each="prod,iterStat : ${prods}" th:class="${iterStat.odd}? 'odd'" th:if="${iterStat.index<4}">
     <td th:text="${prod.name}">Onions</td>
     <td th:text="${prod.price}">2.41</td>
     <td th:text="${prod.inStock}? #{true} : #{false}">yes</td>
  </tr>
 
 10,添加id属性(一般用于设定锚点)
<a th:href="'#tab-'+${li.itemId}">
 
<h1 th:id="'tab-'+${li.itemId}">
 
 11,添加自动跳转锚点
<div th:title="'#slider-direction-'+${iterStat.index}">
 
<div th:id="'slider-direction-'+${iterStat.index}">
 
 12,填加不常见属性
 <div  th:attr="data-slide-to=${ carouselindex.index }">
添加后 div多了一个  data-slide-to=? 的属性

最新文章

  1. shell获取文件最后100行,开头100行,指定开始行和结束行的内容
  2. JavaScript toUpperCase() 方法和 toLowerCase() 方法
  3. SQL,Linq,Lambda之间的转换练习
  4. Visual Studio安装及单元测试
  5. Asp文件锁定脚本
  6. ue4 SNew补遗
  7. STL学习系列四:Stack容器
  8. HDU 1241 Oil Deposits DFS(深度优先搜索) 和 BFS(广度优先搜索)
  9. JavaScript高级程序开发3笔记
  10. markdown与textile之间互相转换
  11. Makefile第三讲:终端传值给Makefile、Makefile传值给C++代码
  12. Amazon才推众包物流,“京东众包”已红绿上阵,“达达”还手握10万配送大军
  13. php SESSION入库的实现
  14. qt delete
  15. 快速搭建一个Quartz定时任务【转载,好文 ,值得收藏,亲身试用 效果不错】
  16. Win7局域网内共享文件设置方式
  17. 【HDOJ1811】【并查集预处理+拓扑排序】
  18. VMWare VSphere6.0的实验笔记
  19. Bootstrap(8) 路径分页标签和徽章组件
  20. python 二叉排序树

热门文章

  1. linux 内核 zImage 生成过程分析
  2. Eratosthenes,筛法求素数
  3. UVa11054
  4. Java 递归调用 recursive 给一个参数 返回一大堆
  5. ADO.NET知识点
  6. xml入门视频
  7. 使用angular4和asp.net core 2 web api做个练习项目(三)
  8. Abp异常-找不到方法:“System.String Abp.Runtime.Security.SimpleStringCipher.Decrypt(System.String, System.String, Byte[])”
  9. 对Numpy广播操作的理解
  10. Leetcode题解(27)