1.判断是否为null
${empty pageNo ? "null" : "not null"}2.三目运算符
${pageNo == 'yes' ? "yes" : "no" } 3.两者结合使用
${empty param.pageNo?1:param.pageNo }
本文介绍了Freemarker模板引擎中用于处理条件逻辑的表达式,包括判断变量是否为null、使用三目运算符进行条件分支选择,以及如何结合这两种语法实现更复杂的逻辑控制。
1.判断是否为null
${empty pageNo ? "null" : "not null"}${pageNo == 'yes' ? "yes" : "no" } ${empty param.pageNo?1:param.pageNo }
被折叠的 条评论
为什么被折叠?