The moose likes HTML, CSS and JavaScript and the fly likes progress bar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "progress bar" Watch "progress bar" New topic

progress bar

krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
good day,
i am saving my data through ajax. i save data in 5 different tables. it takes at least a minimum of 20 seconds for the save to complete. i need a progress bar to keep users informed about the save status, so that they may not be left irritated "what the hell is happening with this application?!..."

have a good day
krishna prasad

have a great day,
krishna prasad
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
A lot of people show a hidden div over the screen or beside the button with an annimated gif.

A site lets you design your own here:

krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
thank you eric,
but my question is, how am i to link the progress bar with server side saving process.
for example, if we are downloading a file, the progress bar increments itself as the download progresses. in the same way, how am i to increment my progress bar depending upon the saving process that is happening in server side?

good day eric,
krishna prasad g
Rax Malhotra

Joined: Nov 19, 2007
Posts: 18
Hi Prasad,

You can write a .txt file like a simple html page having a table inside <div> tag

and import it in jsp page and call the function start & stop as per your requirement frm within the javascript method

************<br />Rax Malhotra<br />SCJP 5.0<br />************
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The download progress bar works because the server tells the browser the file size first. As the browser receives bytes, it can compute the percent complete.

You can't really do that with a process running on the server. You'd have to make the server send percent done updates to the browser, possible but fairly high effort for something that runs a few seconds. Besides which it's hard to tell when a SQL update is 50% done.

If you sent 5 AJAX requests you could keep track of how many have completed, but in a single request I'd probably go with some animation on the browser. I've been around an animated GIF before, and a JavaScript routine that did a text animation. Either of those can run forever if the server hangs or your "stop animation" event fails, and they might tick the user off more than nothing.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: progress bar
jQuery in Action, 3rd edition