aspose file tools*
The moose likes JSP and the fly likes Problem --  getOutputStream() has already been called for this response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem --  getOutputStream() has already been called for this response" Watch "Problem --  getOutputStream() has already been called for this response" New topic
Author

Problem -- getOutputStream() has already been called for this response

yogesh totare
Greenhorn

Joined: Feb 02, 2005
Posts: 15
Hi All,

I have a jsp code(statement) like
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder (response.getOutputStream());

while runing it gives exception on the jboss console like

java.lang.IllegalStateException: getOutputStream() has already been called for this response

can anyone help me to solve this problem

Thanks in advance,

Yogesh...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You'll have a much easier time doing this from a servlet than from a JSP.
If you have so much as a single whitespace character preceding your scriptlet that references the outputstream, you will see this error.

Any whitespace after it will also cause this problem.
JSPs are best for formatting text (html).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
 
subject: Problem -- getOutputStream() has already been called for this response
 
Similar Threads
Struts and output streams
Setting header and fetching OutputStream from Action
problem with servlet->applet communication
Why IllegalStateException ?
getting JasperException