This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Convert and display  image from byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Convert and display  image from byte array" Watch "Convert and display  image from byte array" New topic
Author

Convert and display image from byte array

Red Ajnupez
Greenhorn

Joined: Sep 15, 2013
Posts: 1
I have a method from a webservice that returns a bytearray that is an image and i want to display this as a response.

I tried create a jpg file and then display it but this doesn't work. The file is created but i cant displayed it.

.

Does anyone know how to do this?


Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

If you want to return the image as the response, why are you writing HTML?

Do you want to return the image as the response? Or return an HTML page that contains the image?

I assume the former, but your code is trying to do the latter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Convert and display image from byte array
 
Similar Threads
Servlet creating empty file on saving canvas image
Configuring JNDI for JavaBean in Tomcat 5
display image from bytearray
How can I resize an image from database table and show it
How save an image to file on HD and send to a client link to the file?