I'm wondering if it is possible to return multiple responses/pages from a
given request?

I have a servlet that performs some processing after a form is submitted to
it. This processing sometimes takes several seconds to complete. What I want
to do is first display a page which says "Processing your request, please
wait..." Then, after the processing is done, I want to display another page.
The second page should replace the first page in the user's browser.

Does anyone know if this is possible to do? I want to say that at some point
someone told me that you can do this with "multi-part" something-or-other?

Basically, I want to do something like the following, but, it doesn't work.

   resp.setContentType("text/html");

   PrintWriter pw = resp.getWriter();

   pw.println("<html><head><title>Test</title></head><body>");

   pw.println("<p>Please wait...</p>
");

   pw.println("</body></html>");

   pw.close();

   Thread.sleep(10000);

   resp.setContentType("text/html");

   pw = resp.getWriter();

   pw.println("<html><head><title>Test</title></head><body>");

   pw.println("<p>Processing completed...</p>");

   pw.println("</body></html>");

   pw.close();

Jon


Reply via email to