aspose file tools*
The moose likes Struts and the fly likes Struts progress-bar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts progress-bar" Watch "Struts progress-bar" New topic
Author

Struts progress-bar

Kedar Dravid
Ranch Hand

Joined: May 28, 2004
Posts: 333
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Srinivas Rao
Greenhorn

Joined: Aug 05, 2004
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts progress-bar