aspose file tools*
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
Author

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
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.


Vijay shrivastava
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Displaying .bmp (bitmap file) in jsp