This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes See this code why it gives exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "See this code why it gives exception" Watch "See this code why it gives exception" New topic
Author

See this code why it gives exception

Markandey Sahu
Greenhorn

Joined: Jun 29, 2006
Posts: 13
Hi all
i have one problem pls reply me with reason.
thanks in advance


It gives
java.lang.IllegalStateException: getOutputStream() has already been called for this response
My question is when it's already been called?
And one another question Can we print String in this object

or this object is only for binary output. pls give me reason for both the case
1.servlet class
2.jsp page
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

My question is when it's already been called?

You're in a JSP file. The output stream will be open at the beginning, to output your html tags.

this object is only for binary output. pls give me reason for both the case

It's ok, you can use a String, in a servlet. Just don't use that method in a JSP file, as you've seen in your first question.


[My Blog]
All roads lead to JavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: See this code why it gives exception
 
Similar Threads
See this code it gives exception
Javascript document object writes in a new page?
Which is parsed first in a JSP page - EL, taglib or scriplets
not working on ie
Attempt to clear a buffer that's already been flushed