• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

image display in servlet in browser

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to display blob in browser taken from mysql in servlet can any one give code for this
advance thanks
[ January 23, 2006: Message edited by: Ernest Friedman-Hill ]
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

What part are you having trouble with: the database part, or the displaying part?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When talking about image display in a browser, remember that it takes two things:
1. an IMG tag in an HTML page (or direct URL link) to make a request
2. A servlet to interpret the URL and format the response
Bill
(yes, I know this is obvious but sometimes people try to cram the two together)
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your JSP of HTML file you should set the SRC attribute of your image to a servlet. The servlet will read the image data from the database, set the correct content type, and stream the bytes to the browser.

For Example

HTML code:

<img src=getimage?imageId=someId>

Servlet code:




Take a look at http://fotomica.astrientlabs.com/galleries.jsp. Click around. All the images are handled by a servlet.
 
He's giving us the slip! Quick! Grab this tiny ad!
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic