Richfaces のポップアップ メニューを理解しようとしています。私は次のことをしようとしています: テキストボックスとボタンがあります。テキスト ボックスにテキストを書き込み、書き込まれたテキストの値が「ポップアップ」の場合、ポップアップ メニューを呼び出したいと考えています。コードは次のとおりです。
<h:form>
<h:inputText value="#{popupCall.text}"></h:inputText>
<a4j:commandButton action="#{popupCall.showpopup()}" onclick="if (#{popupCall.showpopup()}) #{rich:component('popup')}.show();">
</a4j:commandButton>
</h:form>
<rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Popup panel" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('popup')}.hide();
return false;">
X
</h:outputLink>
</f:facet>
</rich:popupPanel>
そして豆:
@ManagedBean (name="popupCall")
@VievScoped
public class PopupCall {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public PopupCall() {
}
public void checkText(){
if(text.equals("popup")){
//CALL POPUP MENU
}
}
public boolean showpopup(){
if(text!=null && text.equals("popup"))
return true;
else
return false;
}
}
「if(#{popupCall.showpopup()})」を onclick メソッド内に配置しないと、ボタンが押されたときに常に呼び出されますが、showpopup() メソッドが true を返してもポップアップは表示されません。また、showpopup() メソッド内で、return true と書くだけで、onclick 内の if ステートメントが機能しますが、現在は機能しません。誰でもこれで私を助けることができますか?ありがとう