try
{
//根据系统时间得到文件名
String filename = String.valueOf(System.currentTimeMillis()).concat(
".xls"
);
// 设置下载时客户端Excel的名称
response.setContentType(
"application/vnd.ms-excel"
);
response.setHeader(
"Content-disposition"
,
"attachment;filename="
+ filename);
OutputStream ouputStream = response.getOutputStream();
//HSSFWorkbook wb = new HSSFWorkbook();
wb.write(ouputStream);
ouputStream.flush();
ouputStream.close();
}
catch
(Exception e)
{
e.printStackTrace();
}