Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Progress Bar in JSP

 
Shrikant Raut
Greenhorn
Posts: 7
Java ME Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a quite easy way to implement progress bars in JSP. Basically I have a JSP page that goes to a servlet that calls up a method, now this process is going to run for a long time and I want to indicate the status of the progress just like the progress bar that shows up in the eclipse taskbar when we execute any java program.

Regards.
 
SunilK Chauhan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friend,

Yes it's quit possible with the JSP to make the indication of processing load bar for content loading.

What you have to do is, Set a one new session variable in your Application while you transfer the call to Servlet.
And at the bottom line of your application, put one footer page to indicate the loading bar which one is working based on counter for every 500 ms. I meant to say that at every 500 ms, Your footer is just checking that if session variable is set with the value or not. If it is set than enable it to display processing bar and if not than immediately disable/hide it.

You have to work on footer page and set session variable on every single call to Servlet. And it's done.

It will works fine with the J2EE application as i had already implement it.

Regards,
Sunil Chauhan
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65339
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The modern way to deal with this is to submit the long process via Ajax so that the parent page remains loaded. The parent page can make subsequent requests to the server to get the percentage complete.
 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find this helpful. This is the tool that I would use.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UNLESS you use AJAX to do the upload in chunks, a progress bar will be useless.

That's because in the original HTTP design, all the data is uploaded as a unit in a single HTTP request. The servlet wouldn't even begin processing until after the entire request had been received (it can't, the upload data may be embedded in the middle of other critical information). So the progress bar would only have 2 update points: 0% and 100%.

An AJAX upload can support a progress bar by breaking the request submit into multiple mini-requests and it could then update the progress bar at the end of each mini request/response cycle. The server would then need to assemble them as they come in. Bearing in mind that for maximum reliability you have to allow for the fact that all requests process independently of each other and thus the mini-requests get processed in out of sequence.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic