Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6732159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:36:57+00:00 2026-05-26T10:36:57+00:00

How can I show some loading message when making request using <f:ajax> ?

  • 0

How can I show some loading message when making request using <f:ajax>?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:36:58+00:00Added an answer on May 26, 2026 at 10:36 am

    If you’re not already using a 3rd party component library which could already have a ready-made component for that, such as PrimeFaces with <p:ajaxStatus>, then you can use the JSF-provided JavaScript faces.ajax.addOnEvent() function (and eventually also faces.ajax.addOnError()) to hook a function on ajax events.

    Here’s a basic kickoff example:

    <script>
        faces.ajax.addOnEvent(function(data) {
            var ajaxstatus = data.status; // Can be "begin", "complete" and "success"
            var ajaxloader = document.getElementById("ajaxloader");
    
            switch (ajaxstatus) {
                case "begin": // This is called right before ajax request is been sent.
                    ajaxloader.style.display = 'block';
                    break;
        
                case "complete": // This is called right after ajax response is received.
                    ajaxloader.style.display = 'none';
                    break;
        
                case "success": // This is called when ajax response is successfully processed.
                    // NOOP.
                    break;
            }
        });
    </script>
    
    <img id="ajaxloader" src="ajaxloader.gif" style="display: none;" />
    

    See also section 13.3.5.2 of the Jakarta Faces 4.0 specification:

    13.3.5.2 Monitoring Events For All Ajax Requests

    The JavaScript API provides the faces.ajax.addOnEvent function that can be used to register a JavaScript function
    that will be notified when any Ajax request/response event occurs. Refer to Section 14.4 “Registering Callback
    Functions” for more details. The faces.ajax.addOnEvent function accepts a JavaScript function argument that will be
    notified when events occur during any Ajax request/response event cycle. The implementation must
    ensure the JavaScript function that is registered must be called in accordance with the events outlined in
    Section TABLE 14-3 “Events”.

    Note: in case you’re still using JSF 3.0 or older, then use jsf.ajax namespace instead of faces.ajax as in jsf.ajax.addOnEvent(...).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a UITableView to show some data from an array. This array can
I need to create a slide show of some images that can go full
Can some suggest a good a free memory profiling tool which will show memory
Can anybody provide some instruction on how to setup a war file to show
In Prototype I can show a loading... image with this code: var myAjax =
if so can show simple example, ex in jquery ajax.post
How can I show a loading/progress bar to show how far along that the
I'm looking on how exactly I can show a loading element while the page
I'm using jQuery to implement some ajax features. For example: when a user clicks
I'm using a thread so that I can show a progress dialog while my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.