This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes how can i achieve the idea for download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how can i achieve the idea for download " Watch "how can i achieve the idea for download " New topic
Author

how can i achieve the idea for download

sreelakshmi kolla
Ranch Hand

Joined: Aug 23, 2007
Posts: 35
Hi All,

Here i have one download option,when i clicks on that button,so many number files are coming which are in DataBase.so,here my requirement is when i clicks on particular file,it should recognize the format that particular file,and displaying like a pop-up with two buttons open and save.

give me some idea to proceed to this kind of situation!

Thank you,
Regards,
sreelakshmi.
Tarun Yadav
Ranch Hand

Joined: Sep 20, 2007
Posts: 134
Take a look at this: http://forum.java.sun.com/thread.jspa?threadID=5170452&messageID=9655276
Tarun Yadav
Ranch Hand

Joined: Sep 20, 2007
Posts: 134
Basically, you need to write the binary data stream from your DB to the output stream of the response object. If you set the correct content-type and content-disposition headers, compliant browsers should give you the familiar Open/ Save/ Cancel dialog.

Something like this:



This doesn't have the headers set but you get the idea...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You might also consider extending the Struts DownloadAction to do this.


Merrill
Consultant, Sima Solutions
sreelakshmi kolla
Ranch Hand

Joined: Aug 23, 2007
Posts: 35
thank you very much tarun and merril !
 
Consider Paul's rocket mass heater.
 
subject: how can i achieve the idea for download
 
Similar Threads
MacLookAndFeel for Windows?
Download file from Mysql database
Using JavaScript i want to change the picture
download file using h:commandLink or h:graphicImage
How to download multiple files using struts2