File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "download zip file in struts" Watch "download zip file in struts" New topic

download zip file in struts

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52

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

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

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

Joined: Feb 19, 2008
Posts: 2904

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]
I agree. Here's the link:
subject: download zip file in struts
jQuery in Action, 3rd edition