Description: Generates an AJAX request handler for a long server running, with progress report.

  • Progress report (percentage bar, estimated time or log
  • In execution message
  • Bind to any component and event
  • Success or Failure flexible actions
    • JavaScript block execution
    • Partial stage refresh (from AJAX response, or parcial refresh by rerendering an inner stage (dif:component)
    • Redirect to a stage or URL (on new window if desired)
    • Rendering of HTML templates in dynamic rich JavaScript Dialogs
    • Load mask for post action execution time

JavaDoc: Click here

Body content: JSP content.


Name Description Data type Required Default value
id the ID for this AJAX request String No Auto-generated
ajaxEvent the AJAX event to call String Yes -
bindTo if filled will bind this call to the given element and respective given event String No -
serverCallMessage The text for the server call String No -
showCallMask add a Mask to the current page while the server call is being executed Boolean No True if serverCallMessage is set. False otherwise
showEstimatedTime will add an estimated time info while the server call is being executed Boolean No False
showProgressBar add a progress bar while the server call is being executed Boolean No False
bindTo Allows binding of the dialog to an event of a given element, by it's ID. Notation: "componentID:event". String No -


#1: AJAX request with a progress bar.
Will report errors to the screen in a JavaScript Dialog window, or redirect to the next stage.

    <dif:serverProcess ajaxEvent="ajaxEventName" bindTo="triggerelementID:click" showProgressBar="true">
        <dif:success refreshComponentID="test" stageParameters="param=123" />
        <dif:failure>The request failed with the following error:<br/>$result</dif:failure>

#2: AJAX request with an estimated time remaining.
Will report errors a specific div on the page, or refresh a partial page section (inner stage) on success. Since the success stage refresh is slow, we will show a message while it happens.

    <dif:component stageID="stageThatDisplaysSomeDynamicData" />
    <div id="errorArea" style="display: none;"/>
    <dif:ajaxRequest ajaxEvent="ajaxEventName" bindTo="triggerelementID:click" showEstimatedTime="true">
        <dif:success refreshComponentID="stageThatDisplaysSomeDynamicData" stageParameters="afterUpdate=true"
                     loadingMessage="Updating data..." />
        <dif:failure targetElementID="errorArea">
            The request failed with the following error:<br/>$result

For each of the above, the stage AJAX handler must return an object of: ServerProcessResult. Of course the following is just as illustration. You would have to use some scheduling or threaded execution so your task would run between refreshed of the progress bar.

    synchronized public ServerProcessResult batchAjaxMethod()
        ServerProcessResult processResult = new ServerProcessResult();
        processResult.setCurrentActionDescription("What it is doing now...");
        processResult.setStartDate(new Date());

        return processResult;

See also:

Back to tag reference