Jsp progress bar

Is there an easy way to implement progress bars in the JSP. Basically, I have a JSP page that goes to the servlet that calls the method, now this process will work for a long time, and I want to indicate the progress status in the same way as the progress bar that appears in the eclipse taskbar when we execute any java program.

I found a good tutorial here http://onjava.com/pub/a/onjava/2003/06/11/jsp_progressbars.html , but it seems a bit dated.

Are there any new and easy ways to implement this?

+7
source share
3 answers

Determining the progress of a particular task is an amazingly complex thing when you go into the details. How do you determine, for example, that you are 50%? And what happens if the last 10% of your task takes 1/2 of the total time?

Usually for a web application, if you need progress indicators, it is best to use the AJAX route, like some of the posters mentioned above. However, I find it useful on the Internet to tell the user something . Just show which page will be displayed when the page is sent, and then hidden again when it is displayed ( see here ). This is very easy to do, does not cause any additional performance and indicates some progress.

+3
source

There are many solutions, for example jQuery.

You can use jquery with Ajax to update the progress bar:

http://jqueryui.com/demos/progressbar/

+1
source

In my opinion, when you call your jsp, it should immediately return to the user, but also indicate that a complex task is being considered in the background (for example, using the download counter). If you want to know about the progress of a task, you must use either Ajax polling or Comet push to get it from your server. To get and display the progress, I think Ajax is enough, and the comet may be a bit sorted out. Here is another Ajax approach:

http://en.wikipedia.org/wiki/Ajax_(programming )

More about your question, the servlet (as well as jsp) works according to the HTTP protocol, which is based on the request-> response model. In today's world, there are rarely sites where you switch to jsp to perform a difficult task, and then you need to sit idle until your request is complete. You might want to give your user the freedom to interact with your web application / website while his request is being processed in the background.

0
source

All Articles