如何在 EL 布尔表达式中使用 II(或)
How to use II (or) in EL boolean expression
我想有条件地呈现如下组件:
rendered="#{att.attName != 'att1' or 'att2'}"
然而,这并没有奏效。我已经尝试了 or
和 ||
,但它只评估 OR 条件的左侧,所以在上面的情况下它只与 "att1"
比较而不是 "att2"
如果我更改顺序,那么它将与 "att2"
进行比较,而不是与 "att1"
进行比较。
这应该是你需要的
rendered="#{(att.attName != 'att1') and (att.attName != 'att2')}"
(不需要括号,但我添加它们是为了便于阅读)
我想有条件地呈现如下组件:
rendered="#{att.attName != 'att1' or 'att2'}"
然而,这并没有奏效。我已经尝试了 or
和 ||
,但它只评估 OR 条件的左侧,所以在上面的情况下它只与 "att1"
比较而不是 "att2"
如果我更改顺序,那么它将与 "att2"
进行比较,而不是与 "att1"
进行比较。
这应该是你需要的
rendered="#{(att.attName != 'att1') and (att.attName != 'att2')}"
(不需要括号,但我添加它们是为了便于阅读)