File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Displaying .bmp (bitmap file) in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Displaying .bmp (bitmap file) in jsp" Watch "Displaying .bmp (bitmap file) in jsp" New topic

Displaying .bmp (bitmap file) in jsp

Vijay Shrivastava
Ranch Hand

Joined: Nov 15, 2001
Posts: 64
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

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.

Vijay shrivastava
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

You mention a servlet and a JSP without describing how they interact. Are you accesing the image-loading servlet from a JSP with the <img> tag?

Bear in mind that few browsers are capable of displaying BMP-formatted images.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Displaying .bmp (bitmap file) in jsp
It's not a secret anymore!