• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts progress-bar

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display a progress-bar in my Struts application. When a user clicks a buuton on a JSp page, some heavy background processing takes place and the results (a list of records) is displayed in the same window.I want to display a progress-bar while the list of records is being retrieved. I read an article on ONJava.com, which uses threads to achieve this. I am not too keen on using threads, though.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do something like this:

(HTTP request to /yourapp/JobServlet?action=startjob)
1. Start a background job (using threads, directly or indirectly) and assign it some kind of an identifier, say 1234 for example.
2. Render a HTML page for the client which includes a <META> tag for refreshing to URL /yourapp/JobServlet?action=poll&jobid=1234 after a few seconds or minutes, depending on the estimated duration of the job execution, and make the page say something like "processing your job, please wait..."

(HTTP request to /yourapp/JobServlet?action=poll&jobid=1234)
1. Look at a table of finished jobs.
2. If the job was marked as finished, render a "job complete" HTML page for the client. If the job was still in pending state, render another "please wait" page, effectively making the client wait for another X seconds or minutes. If you want a visual sign of progress, this "please wait" page should include a graphic that represents the progress.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse Koskela, If you have any sample code/example, can you post it here or can you send me aluri.java@gmail.com

thanks in advance
 
Everybody's invited. Except this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic