Oracle ADF popup not showing when button clicked

时间:2015-07-28 15:48:48

标签: oracle oracle-adf jdeveloper

I am new to JDeveloper and ADF. I am trying to make a popup appear on my webpage when I am using JDeveloper to make an ADF application. Here is my code:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="untitled1.jsf" id="d1">
        <af:popup childCreation="deferred" autoCancel="disabled" id="somePopup">
            <af:outputText value="Hello there" id="ot1"/>
        </af:popup>
        <af:commandButton id="button" text="Click me">
            <af:showPopupBehavior popupId="somePopup" triggerType="action" />
        </af:commandButton>
    </af:document>
</f:view>

I believe I have done everything correctly in order for this popup to show, but when I click the button, nothing appears. I was thinking I might need a panel in order to show the text, but I don't think that is necessary. Do you guys have an idea of what's going on or how I should make a popup? My JDeveloper Version is: 11.1.2.2.0. I know this is a simple task, but I am stuck on getting it to show and would appreciate some help. Thanks guys.

4 个答案:

答案 0 :(得分:0)

It is a browser issue. The code is correct, I just can't find a way to get my browser to actually show it.

答案 1 :(得分:0)

Add partialSubmit="true" attribute to your commandButton.

答案 2 :(得分:0)

我认为你错过了页面中的af:form标签。 这在12.1.3中适用于我:

<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <af:document title="untitled3.jsf" id="d1">
    <af:form id="f1">
         <af:popup childCreation="deferred" autoCancel="disabled" id="somePopup">
            <af:outputText value="Hello there" id="ot1"/>
        </af:popup>
        <af:commandButton id="button" text="Click me">
            <af:showPopupBehavior popupId="somePopup" triggerType="action" />
        </af:commandButton>
    </af:form>
  </af:document>
</f:view>

答案 3 :(得分:0)

首先为popup创建绑定。在命令按钮中添加Action Listener。然后在动作事件方法中编写以下代码..

RichPopup.popuphints hints = new RichPopup.popuphints();//hints is the object name
popupbind.show(hints); //popupbind is the property of popup