| Author |
OutputStream already obtained error
|
Subha Rangu
Greenhorn
Joined: Jul 23, 2004
Posts: 29
|
|
Hi, I was trying to use OutputStream object in a JSP page. [Servlet Error]-[OutputStream already obtained]: java.lang.IllegalStateException: OutputStream already obtained I have done opstream.flush() and opstream.close() before and after the usage resp. Please advise me what has to be done. Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
|
Why are you obtaining the output stream in a JSP when it is already exposed to you in the out implicit variable?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Subha Rangu
Greenhorn
Joined: Jul 23, 2004
Posts: 29
|
|
|
I have to show up an image on a JSP which I get from a method which a Java API returns in byte[] format. That is the reason why I am using outputStream.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
A few points: 1) Again, the output stream is already available as 'out'. 2) You can't just emit image data into the middle of a page, you must use an <img> tag. 3) The <img> tag should reference a servlet to return the dynamic image data. JSP is a very poor technology choice for returning non-text data.
|
 |
Julian Kennedy
Ranch Hand
Joined: Aug 02, 2004
Posts: 823
|
|
Bubly, From Tony Morris's response in this thread, you need to ignore the second line. However, as Bear suggests, this may not achieve what you want. The example in the thread describes how to send a TIFF image to the browser from a Servlet. Jules
|
 |
 |
|
|
subject: OutputStream already obtained error
|
|
|