如何根據某些結果從@ManagedBean有條件地顯示/隱藏覆蓋面板。
在下面的代碼中:p:overlayPanel
用於p:commandButton
。我想從Action方法中有條件地顯示覆蓋面板。
現在它顯示每次我點擊commandbutton。p:overlayPanel的條件顯示
<h:form id="form">
<h:outputLabel value="Town Name:"/>
<h:inputText value="#{myBean.town}"/>
<p:commandButton id="checkBtn" value="Check" action="#{myBean.action}"/>
<p:overlayPanel widgetVar="overL" id="over" for="checkBtn">
<h:outputText value="This town is not Listed in our records"/>
</p:overlayPanel>
</h:form>
注意:我使用** Primefaces爲overlayPanel
<p:overlayPanel rendered="{myBean.condition}" ...>...
3.5 **
有同樣的問題,增加widgetVar爲我工作,但我不得不做'PF('myOverlay')。show();' –