This seems to be pretty standard and is not a bug, but rather a good feature to have,
because you can send users to a different page and then finish up processing instead
of them having to wait for it. If you want the page to end after the redirect, just
do a return;
Travis Reeder
Chief Software Architect
ThinkVirtual
---- Original Message ----
From: Cristian Satnic <[EMAIL PROTECTED]>
Sent: 2001-04-26 10:52:52.0
To: JRun-Talk <[EMAIL PROTECTED]>
Subject: response.sendRedirect weirdness ?!?
Hi list,
I just made an interesting discovery that will affect the way we structured
our application here (and probably affect other people too).
Check the code below:
<%
response.sendRedirect("http://www.yahoo.com");
System.out.println("Started - " + new java.util.Date());
for(int i=0; i<1000000000; i++) {}
System.out.println("Done - " + new java.util.Date());
%>
We have a response.sendRedirect followed by a very long for loop (if you
look at the times, you'll see that it takes about 15 seconds to do the
loop). Yet, you'll get redirect to yahoo immediately.
The point is that a response.sendRedirect will redirect immediately while
allowing the code to continue execution. If the code after does cleanup of
SHARED resources between the 2 pages (such as a db connection), you could
get in a situation where the new page starts working on something and all of
a sudden the old page cleans up the resources, resulting in all kinds of
errors.
I assume that this is more or less standard jsp behavior, though I could not
really find it spelled out clearly anywhere.
Just to let you know,
Cristian
----------------------------------
Cristian Satnic
Sr. Consultant
Tigris Consulting
212.481.1174 x10
[EMAIL PROTECTED]
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists