One reason is this: 
After a redirect the servlet that issues the redirect will
continue to run unless you stop the processing with a return 
statement directly after the redirect. Now consider this 
example:

Servlet A:

  doSomething();
  include(Servlet B);
  doSomethingMore();

Servlet B:

  doSomeOtherThing();
  if (condition) {
    respose.sendRedirect();
    return;
  }
  doMoreOtherThings();


This will stop Servlet B from processing doMoreOtherThings()
after the redirect, but Servlet A will still execute 
doSomethingMore().

One other thing with sendRedirect() is, that it is a good 
practice to do the redirect as early as possible.

The later you do it, the higher gets the risk that the 
response header has already been sent to the client. (If you 
produced enough output to force a flush of the outputbuffer)

> -----Original Message-----
> From: Geoff Coffey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 05, 2003 12:49 AM
> To: Tomcat Users List
> Subject: Re: response.sendRedirect( .. )
> 
> 
> Does anybody know the reason for this limitation? 
> Does anybody have a better way to accomplish what 
> I'm describing?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to