How to display a please wait message when the server is processing using addBusyStateListener in ADF ?

Clients often require their ADF applications to process a lot of data or upload big files when their users click on a specific button.
Those treatments can often take a couple of minutes to run and your user may lose patience or wonder why the application isn’t responding.

As a best practice, you should always aim to provide a fast responding application and run the big treatment in an asynchronous way behind the scene to avoid blocking the user interface.

But if you still have to process the long action synchronously, for example, to upload a big file, you need to display a message for the user to know his request is getting processed.
You’ll also need to prevent user interaction with the screen that could stop this treatment being processed. (navigation for example)

To implement it in ADF, you’ll need :

  • A modal ADF popup or another element to display the “processing in progress” message :

Tip 1: Be sure that this group is set on all the page where you need to warn the user. (If you need it more than once set it in a template)
Tip 2: Be sure that the popup is set as clientComponent=”true”. (if not it’ll fail to display most of the time and you’ll have a hard time understanding why)
Tip 3 (optional) : set a pure HTML div <div id=”loaderId”></div> before the popup to simplify getting it’s absolute id. (It’s hard to retrieve the absolute ADF element id in javascript)

  • a client listener to trigger the busy listener only on the buttons where you require the user to be warned :

<af:commandButton text="Do Something" immediate="true" partialSubmit="true" actionListener="DoSomething" >
<af:clientListener method="warnAndPreventUserInput" type="action"/>

  • Define this javascript resource for your page :

Tip 1: Also ensure this javascript is set on the page where you need to warn the user.
(I usually recommend to set it in the header template so it’s available on all page using it)
Tip 2: If your popup often open itself again after being closed the first time be sure to set the listener on the clicked element (clickedElem = evt.getSource();)
Most issues are due to the removeBusyStateListener arguments being different from the previous addBusyStateListener
Tip 3: Refer to the comments describing how we use the ADF public javascript API to get notified when the server is busy and done.
(for more information:

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top