tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Urban" <jim.ur...@netsteps.net>
Subject RE: Possible to return multiple responses/pages for a request?
Date Wed, 22 Aug 2001 12:24:18 GMT
This is an unproven browser side solution which involves JavaScript and
framesets...

1.  The page that submits to the long running servlet should consists of a
frame set.  The one frame is visible and displays the page that allows the
user to input the data.  The second frame is invisible and contains a form
containing duplicate form variables.

2.  The submit button on the user input page does the following:
	1.  Copies the contents of its form variables to the hidden frame's form
variables.
	2.  Redirects the current frame to your "Processing your request, please
wait..." 	page.

3.  Your "Processing your request, please wait..." contains an "onload"
function which calls a JavaScript function in the hidden frame telling the
hidden frame to submit itself to your servlet, targeting either the visible
frame or "top" to replace the frameset completely.


I have not tried this, but I think it should work.  If you try it, please
let me know if it works.

Jim Urban
Product Manager
Netsteps Inc.
Suite 505E
1 Pierce Pl.
Itasca, IL  60143
Voice:  (630) 250-3045 x2164
Fax:  (630) 250-3046


-----Original Message-----
From: Jonathan Eric Miller [mailto:tomcat@shark.uchicago.edu]
Sent: Tuesday, August 21, 2001 4:48 PM
To: Tomcat User List
Subject: Possible to return multiple responses/pages for a request?


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




Mime
View raw message