File Download (two streams at both ends) and file download (two streams)
1.1 download the server-side Write Program (two streams at both ends)
The header that must be set during download: content-Type Content-Disposition
Response. setContentType (getServletContext (). getMimeType (filename ));
Response. setHeader ("Content-Disposition", "attachment; filename =" + filename );
1.2. traverse all files in the directory for download
The linked list is used for query)
Jsp page code implementation:
Server Download and browser Encoding Problems:
1.3. Precautions for file download:
Two streams: the input stream that reads the files to be downloaded. Output stream, send data to the client
2 Head: Set the Data Type of the downloaded file. Tell the browser to process the response data in download Mode
Different browsers need to encode the downloaded file name.