File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes IllegalStateException problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "IllegalStateException problem" Watch "IllegalStateException problem" New topic

IllegalStateException problem

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254

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?


Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Nothing prevents you from outputting after it has been flushed.

[My Blog]
All roads lead to JavaRanch
Tridib Samanta
Ranch Hand

Joined: Apr 28, 2004
Posts: 128
No method of PrintWriter class throws IllegalStateException. You will get IllegalStateException if you try to forward the request to other page after calling flush().

Thanks, Tridib
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
I agree. Here's the link:
subject: IllegalStateException problem
It's not a secret anymore!