This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes download zip file in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "download zip file in struts" Watch "download zip file in struts" New topic
Author

download zip file in struts

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Hi,

I newbee in struts. I have a link in jsp page "Dowload Zip file" which call an action class.

I want action class to zip the entire content of the specified directory and send zip file for downloading.

Please help in order to proceed.

Thanks in advance.
Pramod Chris
Greenhorn

Joined: Oct 15, 2004
Posts: 21
If you need info on how to zip files, then do take a look at the java.util.zip pacakage.

On another note, this really isn't struts related.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

In Action class:
1. Using File class, read the each file
2. Using ZipOutputStream Java API, zip them.
3. Send the resulted zip file stream to the response output OR save the resulted zip file on server and then simply give link to that file.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: download zip file in struts