Forums Register Login
How to dispaly Blob (image) in servlet
So I got a Blob out of the MySql DataBase like:
i = rs.getInt(1);
Blob b=rs.getBlob("img");

How do I show this in a servlet now?
I tried doing: response.setContentType("img/gif");
ServletOutputStream sout = response.getOutputStream();

But It does not work. Please help.

Originally posted by Bikash Jha:
But It does not work.

This is not a useful description of the problem. How is it not working?

P.S. Check your MIME type.
Have you gone directly to the URL which accesses the servlet that outputs this? What do you see? Errors, or garbled nonsense? The mime type is ("img" ?) wrong that's for sure.
Here's an old, related post that may be of help:


This thread has been viewed 2716 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 25, 2018 08:37:05.