Forums Register Login

Displaying .bmp file on the jsp page.

+Pie Number of slices to send: Send
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?

Any suggestion is appreciated.
+Pie Number of slices to send: Send
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.

Dave
+Pie Number of slices to send: Send
Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.

I'm closing this thread, please see the duplicate in JSP's.

Dave.
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


Reply locked
This thread has been viewed 1678 times.
Similar Threads
How can I convert a Hex stream to a bitmap?
DIsplaying Image on JSP
Serlvet to display image - how to prevent client from "Save As Image" ?
tray icon is not displaying
Displaying .bmp (bitmap file) in jsp
Code for binary file to bitmap file conversion
Inserting Image into Oracle.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 23:36:15.