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:

No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter

This thread has been viewed 2590 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 22, 2018 05:50:50.