Hello everybody! I am new to JSP and I am having problems with the <jsp:foward> tag. Here is my situation: I am updating records from a database. The two updates are 1) Modify a db record or 2) delete it. After a successful update i then try to do a jsp foward so that i can go back to the previous page. I always get an error telling me that I cannot clear a buffer which has already been flushed. This is very depressing. It works only if i call jsp foward at the top of the page. I read somewhere that one would normally do a jsp forward before writing to the out object. What's this about?? Please help!!
In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
Joined: Aug 16, 2001
What is your jsp forward stmt? something like this: <jsp:forward page="test.jsp" flush="true"/>
Joined: Aug 27, 2001
Sorry June, if i do as you suggest I get an error. Tomcat is complaining about the flush attribute: can flush=true be used with jsp forward? i thought it could only be used with include? I am using Tomcat 3.2.3. Thanks anyway
Joined: Jul 10, 2001
To answer your question: "<b>I read somewhere that one would normally do a jsp forward before writing to the out object. What's this about??</b>" You can't forward a jsp page (or a servlet, but they are ultimately the same thing in the end) once the output stream has been committed. (flushed) What this means is that you cannot write to the client's browser and then call the jsp forward tag. (I think) Try not outputting anything on the jsp page that is using forward.
Joined: Nov 06, 2000
Yes, in servlets and JSP, output can not be sent to the client before forwarding. That's why you are not getting the error when you do the forwarding as the first thing. Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley