Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

download zip file in struts

 
RaviSingh Kumar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic