• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

monitoring the progress of a servlet

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. if you are going to use Ajax, be sure to use jQuery to do it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic