[英]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.