File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes request/response flushing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "request/response flushing" Watch "request/response flushing" New topic

request/response flushing

rebecca bielecki

Joined: Sep 27, 2001
Posts: 3
This question is probably more suited to another mailing list ... but I want to win the Java Cookbook!
Can anyone explain the most likely cause of the http error message: "ERROR: Cannot forward. The response has already been committed". I know that it means that the headers have already been written - but what does this mean and how can I avoid it?
timothy zimmerman
Ranch Hand

Joined: Jun 26, 2001
Posts: 149
This is probably a better question for the Servlet/JSP forum. You don't mention if you are getting this error from a Servlet or JSP? There may be a few causes for this but one cause may be that you are trying to do a forward after getWriter()?
[This message has been edited by timothy zimmerman (edited September 28, 2001).]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

True, you're in the wrong forum (but I want one too )
You should be careful to never write anything to the response until you are sure that is what you want to display. Model-View-Controller (or Model 2 Architecture) is a great way to reduce these problems.
Essentially a servlet is the controller, it decides which JSP (view) gets to display the data but is not allowed to display data itself. Since the controller doesn't write any data it is free to forward whenever it wants...
I agree. Here's the link:
subject: request/response flushing
It's not a secret anymore!