Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use photographs in the database like orkut.com

 
ramandeep singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am working on a post resume and picture application
and now i have picture and resume in database
i wanna show the list of resumes with the pictures displayed in the list
i know how to downlaod the picture but how to put tht in image tag
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:img action="/myDownloadAction" />
 
ramandeep singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:img action="/myDownloadAction">
this will give me a link to the action page
but how to receive image from database
and display it in the list with pictures
like the list of people who sent you scrap in orkut
the picture of person is also there
and my picture is in database
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written code to do this in the past. Basically what you need to write is an action that will read the image from the database and stream the binary image back. You will then use the syntax that Merrill provided to call this action (it does not give you a link).

I have heard of the DownloadAction that is included with Struts but I have not used it (looks like since 1.2.6...I think I am using 1.1). If you are using 1.2.6 or newer, I suggest that you use DownloadAction. If you are using an older version I suggest that you download the 1.2.6 source code and look at how DownloadAction works. It is likely only about 20 lines of code.

http://struts.apache.org/1.x/struts-extras/apidocs/org/apache/struts/actions/DownloadAction.html

- Brent
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link has an example of reading from a BLOB in a database and downloading it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic