Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i achieve the idea for download

 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 134
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also consider extending the Struts DownloadAction to do this.
 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much tarun and merril !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic