Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
yogesh totare
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic