This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

monitoring the progress of a servlet  RSS feed

 
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
 
Sheriff
Posts: 67261
170
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
Sheriff
Posts: 67261
170
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
Sheriff
Posts: 67261
170
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.
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!