条件表达式形式:condition, then and else

<tr th:class="${row.even}? 'even' : 'odd'">
...
</tr>

混合使用表达式实例:

<tr th:class="${row.even}? (${row.first}? 'first' : 'even') : 'odd'">
...
</tr>

其他表达式也可以省略,在这种情况下,返回一个null值如果条件是错误的

<tr th:class="${row.even}? 'alt'">
...
</tr>

thymeleaf条件表达式的更多相关文章

  1. (五)Thymeleaf标准表达式之——[7->8]条件表达式& 默认表达式

    2.7 条件表达式 模板名称:condition-express.html <1>a ? b:c  (if then:else) <2>a?c (if else) 条件表达式( ...

  2. Thymeleaf 标准表达式语法

    变量表达式${ } 在控制器中往页面传递几个变量: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @Controller public class IndexController ...

  3. Thymeleaf 页面表达式基础

    转自:http://www.cnblogs.com/vinphy/p/4674247.html#undefined (一)Thymeleaf 是个什么?      简单说, Thymeleaf 是一个 ...

  4. [Django]模型提高部分--聚合(group by)和条件表达式+数据库函数

    前言:本文以学习记录的形式发表出来,前段时间苦于照模型聚合中group by 找了很久,官方文章中没有很明确的说出group by,但在文档中有提到!!! 正文(最后编辑于2016-11-12): 聚 ...

  5. Scala:条件表达式的好处

    条件表达式的好处之一是:让代码更简洁,例如在一个需要根据不同条件收集不同值的场景中,多数语言提供的代码如下: ; ) { tmp = xxx; } ) { tmp = yyy; } else { tm ...

  6. Shell 条件表达式汇总

    条件表达式 文件表达式 if [ -f  file ]    如果文件存在if [ -d ...   ]    如果目录存在if [ -s file  ]    如果文件存在且非空 if [ -r f ...

  7. shell之条件表达式

    conditional expressions are used by the [[ compound command and the test and [ builtin commands. ari ...

  8. Python学习教程(learning Python)--3.3 分支语句的条件表达式详解

    本节主要讨论分支语句的条件表达式问题. 在if或者if-else分支控制语句里由于都用到条件判断(表达式是真还是假),条件判断可以是一种关系运算也可以是布尔表达式. 本节将对if及if-else语句的 ...

  9. golang没有条件表达式?:

    详见The Go Programming Language Specification中Expressions一章中未提及此表达式, 故其不支持. 再强调一次, GO不支持条件表达式 conditio ...

随机推荐

  1. AVL的旋转

    转自http://blog.csdn.net/gabriel1026/article/details/6311339 平衡二叉树在进行插入操作的时候可能出现不平衡的情况,AVL树即是一种自平衡的二叉树 ...

  2. Android系列之Fragment(一)----Fragment加载到Activity当中

    Android上 的界面展示都是通过Activity实现的,Activity实在是太常用了.但是Activity也有它的局限性,同样的界面在手机上显示可能很好看, 在平板上就未必了,因为平板的屏幕非常 ...

  3. BZOJ1048: [HAOI2007]分割矩阵

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1048 题解:搞清题意之后来个记忆化爆搜就行了. 代码: #include<cstdio& ...

  4. error LNK2019: 无法解析的外部符号 __imp___CrtDbgReportW

    error LNK2005 and error LNK2019 error LNK2019: unresolved external symbol __imp___CrtDbgReportW refe ...

  5. Java [Leetcode 58]Length of Last Word

    题目描述: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return ...

  6. 【C#学习笔记】获得本机IP

    using System; using System.Net; namespace ConsoleApplication { class Program { static void Main(stri ...

  7. poj 2063 Investment

    题意:给定一个初始资金capital,然后给定d种投资方案,每种投资方案中有投资额value[i](是1000的倍数)和利息interest[i],每年的投资就可以拿到全部利息,然后累加起来继续投资利 ...

  8. PHP最佳实践(译)

    原文: PHP Best Practices-A short, practical guide for common and confusing PHP tasks 译者:youngsterxyf 最 ...

  9. System.arraycopy方法

    数组的复制有多种方法,其中有一种就是System.arraycopy方法,传闻速度也很快. 方法完整签名: public static void arraycopy(Object src, int s ...

  10. 【转】自定义UITableViewCell控件阻挡回调不到didSelectRowAtIndexPath的解决办法

    原文网址:http://blog.talisk.cn/blog/2015/09/01/uitableview-didselectrowatindexpath-cannot-be-called-tips ...