aspose file tools*
The moose likes Struts and the fly likes use photographs in the database like orkut.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "use photographs in the database like orkut.com" Watch "use photographs in the database like orkut.com" New topic
Author

use photographs in the database like orkut.com

ramandeep singh
Greenhorn

Joined: Jan 16, 2007
Posts: 13
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

Joined: Feb 15, 2005
Posts: 4864
<html:img action="/myDownloadAction" />


Merrill
Consultant, Sima Solutions
ramandeep singh
Greenhorn

Joined: Jan 16, 2007
Posts: 13
<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

Joined: Feb 08, 2006
Posts: 948
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

Joined: Feb 15, 2005
Posts: 4864
This link has an example of reading from a BLOB in a database and downloading it.
 
wood burning stoves
 
subject: use photographs in the database like orkut.com