<span style="font-size:14px;">File file = new File(filePath);
try {
InputStream fis = new BufferedInputStream(new FileInputStream(file));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
ServletActionContext.getResponse().addHeader("Content-Disposition", "attachment;filename="+filename);
ServletActionContext.getResponse().addHeader("Content-Length", "" + file.length());
ServletActionContext.getResponse().setContentType("application/vnd.ms-excel");
OutputStream os = new BufferedOutputStream(ServletActionContext.getResponse().getOutputStream());
os.write(buffer);
os.flush();
os.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}</span>