Java batch files are compressed, exported and downloaded to the local sample code
It mainly uses org apache. tools. zip. Zipoutputstream is a zip stream. Here, take EXECL as an example.
Idea: first write the zip stream into the HTTP response output stream, and then write the excel stream into the zip stream (there is no need to generate a file and then package it. Just read and write the data from the EXECL template, output it to the zip stream, and set the file name for each stream)
For example, 1. 0 exists in the EXECL file under webapp xls,2. xls,3. Xls file
1.Controller
2.Service
The final result generates a report Zip, which contains three files 1 xls,2. xls,3. xls
summary
The above is the Java batch file compression, export and download to the local sample code introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!