• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying .bmp (bitmap file) in jsp

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic