I will second the remarks about this particular behavior. It is a bug and isn't normal 
behavior. I believe the behavior was present in version 5 and 6.
 
the solution is to well, not do that, since it's not logical. what I ended up doing 
was to place the sendRedirect logic at the top of a JSP page and redirecting before 
anything happens. that was the only way i could ensure correct behavior, especially 
when redirects and forwards were used together to direct a request.
 
peter
 
 Tim Funk <[EMAIL PROTECTED]> wrote:Weblogic isn't the best at obeying the spec. (From 
past painful experience)

You probably have code which is sending data to the browser and then the 
response is getting committed. Then you try a 
RequestDispatcher.forward(). This is illegal with respect to the spec. 
It could be because weblogic had a larger buffer than tomcat before 
flushing. See the jsp(and/or servlet) spec for the declaration to 
enlarge the buffer for your request.

A simple way to reproduce:
    /* Write a 50kb string to ensure response is committed */
    char[] c = new char[1024*50];
    java.util.Arrays.fill(c,'z')
    out.println(new String(c));
%>


---------------
Another common way is to get this error is by performing a sendRedirect 
in a jsp and then printing more data out, for example:

Wacky text here.
---------------

A simple way to resolve:
    return;
%>
Wacky text here.


-Tim

Aidan Monroe wrote:
> I have a .war file that runs perfectly in WebLogic
> 7.0. Today I tried to run that same .war in Tomcat
> 4.0.6. Unfortunately, it did not run. I get the
> following error:
> 
> java.lang.IllegalStateException: Cannot forward after
> response has been committed
> 
> Now, I know what this error means, but I don't know
> why I would get it when I run in Tomcat but not
> WebLogic. Is there something that I need to set in
> Tomcat to avoid this?
> 
> Please note that I am new to Tomcat so I apologize in
> advance if this is a stupid question.
> 
> Aidan
> 


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



---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

Reply via email to