This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I would like to display a bitmap (.bmp File) on a jsp page. Servlet is able to read the BLOB from databse and byte stream is written successfully to response.
But at the jsp side nothing get displayed.
In servlet code I have done the outstream.flush(); and res.flushBuffer(); Also stream is closed.
I have tried both following ContentType res.setContentType("image/x-ms-bmp"); res.setContentType("image/bmp");
At present I am not trying to convert the format to any other but would like to display as the raw data read from the database. Is there any issue in not doing conversion and trying to display bitmap image?
This is not the fault of the JSP, browsers typically don't support bitmaps without some sort of external plugin. Your options would be to find a plugin for your browser that lets it display bitmaps, or convert the image to something else (like a png) before sending it to the client.