hi All, I am checking a particular condition and forwarding to a jsp page using forward tag in jsp. It throws java.io.IOException :Error Attempting to clear a buffer that has aready been flushed. I also changed the sameusing sendRedirect("eeee.jsp"). It throws java.lang.IllegalStateException.Pl. hep .I am not able to proceed further. Thanx in advance..
The client sends a request to the server, the server tries to decide what the response is and then replies with it. The problem you are getting is that forward is equivalent to saying "I'm not going to provide the response here, the response will come from another page". If you have sent any data to the client, the OutputStream attempts to buffer it for as long as it can (default of 8k?) then it has to send a response. Any time up to when the response is sent, it is possible to clear the buffer and change the data sent to the client. After the data has been sent, it is no longer possible to clear the cache since it has been sent to the client. There are several causes for this and several ways around it, but my preference is the Model-View-Controller (MVC) Basically the client only ever asks for a servlet. Each servlet (or controller) decides on the data that get displayed (the model) but the servlet is not allowed to display any data itself (no HTML in a servlet). The controller does, however, place all the data it has collected on the request (req.setAttribute) the decide on the JSP (VIEW) that will display the data and forwards to that JSP. I hope this clears it up a bit... Dave.
Bhuvana Bala
Greenhorn
Joined: Jul 19, 2001
Posts: 10
posted
0
Hi Dave, Thanx. I cleared it. In the same jsp I had include <jsp:include /flush="true"/>. when I deleted the above line I was able to redirect to the next page,Thanx once Again, Bhuvana
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: forward page- Tag Throwing Exception.Pl... help