File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display a picture stored in a DB with HTML

 
bequibeck
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to store picture in a DB and then I must display them in a web page with HTML,but to display a picture in HTML we have to give the path of the picture and not directely the picture.Is there an other solution?Help me please...
And Can I use ImageIcon in a JSP page?
[ February 07, 2002: Message edited by: bequibeck ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For pictures from a database your link should go to a servlet which uses the request information to get the image as a byte array and serve it. You must set the content type and it works best if you set the content length.
Bill
 
Laurent Sate
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You must set the content type and it works best if you set the content length.

Could you explain me more in detail your solution? Maybe a little example?
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"bequibeck"
Your name doesn't agree with the javaranch guidelines. Please take a moment and edit your profile after reviewing the guidelines at http://www.javaranch.com/name.jsp
Please change your Publicly Displayed name to follow the guidelines.
thanks for your cooperation.
- satya
 
Adam Hardy
Ranch Hand
Posts: 567
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, Bill, that is an absolutely excellent solution. I never would have thought of just serving a gif as a byte array.
Is it a major performance issue though? I mean, how much slower would it be than just having images in a directory? Would the app server cache the response?
Thanks
Adam
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic