Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 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;
这是我们目前在单个表达式中处理多个条件时使用的。
example.php ~ 当我选中 example.php 网页中的复选框时.. 然后我点击打印按钮,该值将传递给 example1.php
if($items) { foreach($items as $i) { print"<input name='checkbox[]' type='checkbox' id='chec