I have a Servlet that does an extensive search which may take up to 1-2 minutes to finish. I would like to display a "Please wait ...." page while the search is being performed and before the search results are displayed. How can I do this?

Perry Tew


I've written a servlet that does this same thing (well, it executes a long query). What I did was to create a class that spawned a thread to do the query. I then set flags to indicate the query was underway. Whenever a request came in, I checked the flags and output html based on whether the query was done or not. I added some extra bells and whistles, such as how many records had been retrieved so far.

I put it together pretty quickly, so it may not be the most professional solution, but you're welcome to look at the code to gain an idea of how I did it. (You may have to scrape out some query code, but it's not much.)

You may view the code at my home page (http://www.geocities.com/perry_tew/jsp_code/refreshservlet/). There are three source files: a bean, a servlet, and a web.xml file. If you have any questions, let me know.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact