wood burning stoves 2.0*
The moose likes JSP and the fly likes method to ouput an image from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "method to ouput an image from JSP" Watch "method to ouput an image from JSP" New topic
Author

method to ouput an image from JSP

Joel Karimpil
Ranch Hand

Joined: Oct 04, 2004
Posts: 53
i need to output an image from a jsp using the outputstream object.

(if there is a better way plz let me know)

this image i am trying to read into an inputstream an store it an bytearrayoutputstream , then sending it .
plz tell me how to do it.


Yours Truly,
Joel Karimpil
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you don't need to...
Use a servlet instead to output the binary data. Far cleaner and easier solution.

And never try to mix different mimetypes in a single response, it just won't work (so don't think you can write a single JSP that returns both the text of your page and the image data).


42
Joel Karimpil
Ranch Hand

Joined: Oct 04, 2004
Posts: 53
Hi Jeroen,

thanks.
but can u tell me how to or refer me to some sample code.
Al Petersen
Greenhorn

Joined: Nov 27, 2004
Posts: 9
Here's some code I use in one application to render a progress bar:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: method to ouput an image from JSP