• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

out.flush() before jsp:forward

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shini Akshi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic