Wed. Jan 26th, 2022

Requirement: I have a button with the name as “Launch Popup“. When I click on the “Launch Popup” button it opens a popup. Now, as per my requirement the popup should close automatically after 5 seconds of its launch.

Here we will be using the af:poll component.

af:poll component: The poll component delivers PollEvents to the server at fixed intervals. This can be used either for steady updates, or to deliver a heartbeat to keep a user logged in, or to warn a user about to be logged out.

Polling can be disabled by setting interval attribute to a negative value.

Polling can be disabled globally at application level when in automation mode based on the value of the following property within adf-faces-config element of adf-config.xml. The default value is ‘on’.

To know more on af:poll component click here

Solution: For solution of the above requirement follow the steps as shown below:

Step 1: Create an Oracle ADF Fusion Web Application.

Step 2: Create a demo.jspx page inside the ViewController project.

Step 3: Drag and drop af:button inside the demo.jspx page. Set text=”Launch Popup”.

Step 4: Drag and drop af:popup just below the af:button. Create the binding for the af:popup as binding=”#{pageFlowScope.MyBean.popupBinding}”

Step 5: Drag and drop af:dialog inside the af:popup. Drag and drop af:outputText inside the af:dialog. Set value=”Auto dismiss popup after 5 seconds

Step 6: Drag and drop af:showPopupBehavior inside the “Launch Popup” button. Set popupId=”p1″, and triggerType=”click”

Step 7: Drag and drop af:poll inside the af:dialog. Set interval=”5000″, timeout=”5001″, and pollListener=”#{pageFlowScope.MyBean.autoDismissPopup}”

Thus, the complete demo.jspx page is shown below:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:f=""
    < contentType="text/html;charset=UTF-8"/>
        <af:document title="demo.jspx" id="d1">
            <af:form id="f1">
                <af:button text="Launch Popup" id="b1">
                    <af:showPopupBehavior popupId="p1" triggerType="click"/>
                <af:popup childCreation="deferred" autoCancel="disabled" id="p1"
                    <af:dialog id="d2">
                        <af:poll id="p2" interval="5000" timeout="5001"
                        <af:outputText value="Auto dismiss popup after 5 seconds" id="ot1"/>
                        <f:facet name="buttonBar"/>

And the complete code is shown below.



import org.apache.myfaces.trinidad.event.PollEvent;

public class MyBean {
    private RichPopup popupBinding;

    public MyBean() {

    public void setPopupBinding(RichPopup popupBinding) {
        this.popupBinding = popupBinding;

    public RichPopup getPopupBinding() {
        return popupBinding;

    public void autoDismissPopup(PollEvent pollEvent) {

Save all and run the application. Thus, the ran application is displayed below.

Click on the “Launch Popup” button and it will launch the popup with dialog as shown below.

If you notice, it will automatically close the popup after 5 seconds of its launch.

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 490 total views,  1 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *