public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
String filename = request.getParameter("fileName");
String fileDisplayName = filename.substring(filename.lastIndexOf("/")+1);
String dataFileLocation = "C:\"
File f = new File(dataFileLocation+"\\"+filename);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline; filename="+fileDisplayName);
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "no-store");
response.addHeader("Cache-Control", "max-age=0");
FileInputStream fin = null;
try {
fin = new FileInputStream(f);
} catch (FileNotFoundException e) { e.printStackTrace();}
int size = 1024;
try {
response.setContentLength(fin.available());
byte[] buffer = new byte[size];
ServletOutputStream os = null;
os = response.getOutputStream();
int length = 0;
while ((length = fin.read(buffer)) != -1) {
os.write(buffer, 0, length);
}
fin.close();
os.flush();
os.close();
} catch (IOException e) { e.printStackTrace();}
}