[英]JSF EL and + or condition
与EL中一样,格式化以下条件的最佳方法是什么?
#{bean.booleanValue and (bean.stringValue ne 'MYCLOSED' or bean.stringValue ne 'ALLCLOSED')}"
方括号似乎没有被识别为有效的表达式,但是要求该语句在逻辑上呈现如下:
bean.booleanValue && (bean.stringValue != 'MYCLOSED' || bean.stringValue != 'ALLCLOSED')
您可以对第一个表达式使用三元运算符,如果它的计算结果为true,则对其余表达式进行计算,否则返回false。
例如bean.booleanValue ? bean.stringValue ne 'MYCLOSED' or bean.stringValue ne 'ALLCLOSED' : false;
bean.booleanValue ? bean.stringValue ne 'MYCLOSED' or bean.stringValue ne 'ALLCLOSED' : false;
这是当前在单个表达式中处理多个条件时使用的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.