• Post Reply Bookmark Topic Watch Topic
  • New Topic

IllegalStateException problem

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Above is part of a code in a Servlet.
But I am not getting IllegalStateException in the line
writer.println("After Flush"); although I have committed the response
the line before.

Where am I going wrong?

Regards,
Joshua
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing prevents you from outputting after it has been flushed.
 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No method of PrintWriter class throws IllegalStateException. You will get IllegalStateException if you try to forward the request to other page after calling flush().
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!