Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

monitoring the progress of a servlet  RSS feed

 
rawia karoui
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i need to monitor the progress of servlet's treatment.
i have a while loop executed in the servlet and i need to know the progress of its counter via the JSP page, this counter will be a progress bar counter so the user can know the servlet's progress.
so what i want to know how to get each counter's valus via JSP
Please help it's urgent
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the servlet being invoked? If from a form submission or page link, this is impossible as the browser is inactive while waiting for the response.

If it's happening via Ajax, then there's a way to do this but it's complicated.
 
rawia karoui
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank's for responding and i am sorry to write that
yes it is launched from a from but if there a possibility to do it via ajax, let's do it but i am novice with ajax
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is that if the request to the long-running servlet is made via Ajax, it is happening asynchronously and script on the page continues to run. Once you submit a form, the page unloads.

While an Ajax request is active, you can issue other Ajax requests that can call the server and monitor the progress of the longer-running servlet -- assuming, and this is the big complication, that that servlet is somehow able to make its progress known to the other requests. It could record progress in the session, or perhaps the DB, and the "status servlet" could read that progress and report it back to the page.

An element such as the jQuery UI progressbar widget can be adjusted with the result to convey the progress to the user.

Of course, you could also opt to just return from the long-running process right away (by doing the actual work in a new thread), and let the use check the progress later.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. if you are going to use Ajax, be sure to use jQuery to do it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!