Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts progress-bar

 
Kedar Dravid
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.
 
Lasse Koskela
author
Sheriff
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.
 
Srinivas Rao
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic