Hi, I want to download a zip file through a jsp.The file is placed in the Project folder(where the
jsp and the corresponding
servlets are placed). The parameters that are given as input to JSP are the filename and the path.
The following is the code i tried but,that downloads a junk file.
Can anyone help me to resolve this..
String filelist = (String)request.getAttribute("filename");
// String fileName = "005C061S200409.zip";
String encodeUrl = null;
String path = "/configuration/downloadfile/";
System.out.println("The path is "+path);
String filedownload = path + filelist;
System.out.println("The downloadFile is "+filedownload);
encodeUrl = response.encodeURL (filedownload);
System.out.println("The encodeUrl is "+encodeUrl);
// response.setHeaderi ("Content-Disposition", "inline;filename=\"" + encodeUrl);
// response.setContentType ("application/text; charset=UTF-8");
response.setHeader ("Content-Disposition", "inline;fileName=\"" + encodeUrl);
response.setContentType ("application/zip; charset=UTF-8");