Forums Register Login

out.flush() before jsp:forward

+Pie Number of slices to send: Send
Hi Everybody,

It is mentioned in HF Jsp and Servlet book on p-412. that IllegalStateException is thrown but when i do flush/commits the response before <jsp:forward..it will display the page before <jsp:forward..and following exception comes on server console..

java.io.IOException: Error: Attempt to clear a buffer that's already been flushed

Please clarify that which exception should be thrown.


Sincerely,
Pawanpreet Singh
SCJP 5.0
Target SCWCD 1.4
+Pie Number of slices to send: Send
Hi

I also tried some codings and found IllegalStateException not thrown (I used Tomcat).Any println codes befor forwarding was printed,but page doesn't forwarded. Containers might handle this in different way and most containers have handled throwing this exception .
Please correct me if I am wrong
+Pie Number of slices to send: Send
Thanks for your response.

You are right, but how can we handle such a question in real exam...should we select IllegalStateException or anything else.


Thanks
Pawan
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1896 times.
Similar Threads
Help with getOutputStream() Exception
HFSJ out.write() jsp:forward
Illegal State Exception: Ref Page 412 HF Book
Regarding out.flush() in <jsp:include> and <jsp:forward>
SCWCD hints
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:27:30.