joe*_*hon 1 spring spring-mvc thymeleaf spring-boot
我尝试了 if object.qtdItem == 0
,然后将 TD 的颜色设置为红色:
<td th:style="${obj.qtdItem == 0 ? 'color: red;'}" th:text="${obj.text}"></td>
Run Code Online (Sandbox Code Playgroud)
但这发生了
error: Caused by:
org.springframework.expression.spel.SpelParseException: Expression
[perfil.qtdItem == 0 ? 'red'] @38: EL1044E: Unexpectedly ran out of
input
Run Code Online (Sandbox Code Playgroud)
三元语句需要一个else
子句,例如
<td th:style="${obj.qtdItem == 0 ? 'color: red;' : 'color: some_other_color;'}}" th:text="${obj.text}"></td>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15447 次 |
最近记录: |