[英]Iterate over ArrayList of Entities obtained from a query within a JSF page
[英]Comparing a Java ArrayList within a JSF Page
我想檢查arrayList是否包含JSF中的特定元素。
ArrayList是nonTradList,包含幾個值。 sProcessorView是Java類的實例
JSF頁面如下所示-
<h:commandButton id="p"
value="#{msgs['SP.Pend.Button.Label']}"
type="button"
disabled="#{securityView.readOnlyUser or sPView.readOnly}">
<rich:toolTip style="white-space:nowrap" value="Ctrl-Shft-P" />
<a4j:support event="onclick"
oncomplete="if ((!#{sProcessorView.autoFetchNext}) &&
#{sProcessorView.nonTradList.contains('100')} &&
#{spProcessorView.nonTradList.contains('111')} ) openSimplePop() ;
else openModal();" />
</h:commandButton>
是否已經有EL,或者我必須寫一些自定義標簽?
我們還可以從此JSF調用Java方法以獲得結果嗎?
任何幫助都非常感謝
您可以在ManagedBean上創建一個返回布爾值的方法
public boolean containsValue() {
//Check if the value is in the list...
}
在頁面上,您可以執行以下操作:
var showModal = #{bean.containsValue()};
if(showModal) {
openModal();
} else openSimplePop();
這樣,您可以檢查ManagedBean上的列表是否包含該值,如果是,則該方法將返回true,該值將在JS變量上設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.