<table border="1">
<tr th:each="skuImage:${skuInfo.skuImageList}">
<td th:text="${skuImage.id}"></td>
<td th:text="${skuImage.imgName}"></td
tr>
</table
<table>
<!-- <c:foreach items="${arrayList}" var = "arry">-->
<tr th:each="arry,stat: ${arrayList}">
<td th:text="${arry}"></td>
<td th:text="${stat.index}"></td>
</tr>
</table>
-
ThymeLeaf特点:
-
-
ThymeLeaf:建立在自然模板上(H5标签),渲染数据的时候,都是一些h5的扩展标签属性。
-
jsp:建立在自然模板上,渲染数据的时候,需要使用JSTL,EL表示式。
-
-
ThymeLeaf与FreeMarker比较
-
ThymeLeaf:建立在自然模板上。
-
FreeMarker:必须先用ftl模板。
-
-
-
ThymeLeaf的使用:
-
现在页面中引入ThymeLeaf的命名空间 (页面开头的html标签替换)
-
在后台存值,前台显示。
-
-
ThymeLeaf标签:
-
带索引的循环
-
取session中的值
-
div th:text="${session.userName}"> </div
-
-
<div th:include="itemInner"/>
-
-
判断
-
三元运算:
-
<td th:text="(${skuImage.id}=='10')?'是10':'不是10'"></td<td th:text="${类.属性名}==值?'正确的输出结果':'错误的输出结果'">
-
普通判断
-
<td th:if=>123456</td 如果判断成立,直接输出123,如果没有th:text标签,那么就输出div标签中的123456
-
来源:51CTO
作者:零零渣(java的渣)
链接:https://blog.csdn.net/weixin_42635759/article/details/100578263