This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!