thymeleaf

【一】三元运算符

select中:
<select class=”form-control” id=”mt” name=”noticetype”>
<option value=”0″>–请选择–</option>
<option th:each = “noticetype : ${noticetypeList}” th:selected=”${noticetype.id} eq ${noticemodel.noticetype} ? true : false” th:value = “${noticetype.id}”>
<span th:text=”${noticetype.name}”></span>
</option>
</select>

class中
<a href=”/” th:class=”@{(${category} eq ‘home’ ? ‘active-class’ : ”)}” class=”active-class”>首页</a>

text中
<td th:text=”${bidAnnounceDO.f eq 1 ? ‘已发布’ : ‘未发布’”}></td>
//如果有多个用()括起来,如:
<td th:text=”${bidAnnounceDO.f eq 1 ? ‘已发布’ : (${bidAnnounceDO.f} eq 2 ? ‘考虑中’ : ‘未发布”’)}”></td>

【二】多条件判断
th:if=”${bidSuppreDO.result eq 0 && bidSuppreDO.f eq 0}”

【三】关系运算符
gt:great than(大于)>
ge:great equal(大于等于)>=
eq:equal(等于)==
lt:less than(小于)<
le:less equal(小于等于)<=
ne:not equal(不等于)!=

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理