thymeleaf小记
来源:互联网 发布:人工智能应用文献综述 编辑:程序博客网 时间:2024/05/17 06:25
@的使用
<link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet">
@要注意加不加“/”的区别
if的使用
<div th:if="${fileUrl eq '${fileUrl}'}">${fileUrl}</div>
<img th:if="${fileUrl eq '${fileUrl}'}" th:src="${fileUrl}" class="img-responsive"/>
1、遍历:
we will use th:each in our template to iterate the list of products:<tr th:each="prod : ${prods}">
<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>
输入:
<input type="text" name="userName" value="James Carrot" th:value="${user.name}" />
value为placeholder,value输入后会被解析覆盖
又如:
<form action="/gtvg/subscribe">
<fieldset>
<input type="text" name="email" />
<input type="submit" value="¡Suscríbeme!"/>
</fieldset>
</form>
1.Text literals: '...'
2.Number literals: 0,1.0,12.3,etc
Simple expression: 表达式语法
1.Message expression : #{}
2.Variable expression : ${}
3.Link URL expression: @{}
4.Selection Variable expression: *{}
结合th:object使用,在某个范围内进行变量的查找,而不是在context中查找,缩小了查询的范围,效率如何呢?
如何没有与th:object结合使用,*{}与${}效果一样,因为其范围自动扩展到context。
0 0
- thymeleaf小记
- thymeleaf 用法小记
- Thymeleaf
- thymeleaf
- thymeleaf
- Thymeleaf
- Thymeleaf
- Thymeleaf
- Thymeleaf
- Thymeleaf
- Thymeleaf
- Thymeleaf
- 小记
- 小记
- 小记
- 小记
- 小记
- 小记
- 使用Java来实现String字符串和Byte[]数组的转换
- Android 如何在进入有scrollView的页面时滑动条置顶
- Ubuntu 安装 vim 失败
- 现代GPU的体系结构
- windows下安装numpy模块的安装
- thymeleaf小记
- php生成缩略图
- Codevs_P1076 排序(优先队列)
- 内存管理,WEAK 和 UNOWNED
- android sqlite
- 《leetCode》:3Sum
- 第八周项目4 字符串加密
- failed to open stream: HTTP request failed!
- BFS(广度搜索)+DFS入门(深度搜索)详解