• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

download and save a zip file from server

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to downlaod a zip file through the response of a Action class and save it in the client machine. How it can be done.

Regards

Uday
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest way to do this is to create a link to the file. The browser will recognize that the file's suffix is not html, and will ask the user for a location to download it to.

for example:


you could also write a servlet that would read the file and send it as a byte stream, but why go to all that trouble, when a simple link will do the job?

Merrill
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do simple forward to zip file (It's worked)
So doing this you can benefit of control
(File download can be selective) and you don't need to worry about
streams and buffering
[ February 24, 2005: Message edited by: Eugene Lucash ]
 
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Udaya Raj:
I want to downlaod a zip file through the response of a Action class and save it in the client machine. How it can be done.



Use the ServletOutputStream. Here's an example:

http://strutsblobapp.sourceforge.net/xref/example/struts/FileDownloadAction.html
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic