public void download() throws Exception {
HttpServletResponse response= ServletActionContext.getResponse();
HttpServletRequest request =ServletActionContext.getRequest();
String path = request.getSession().getServletContext().getRealPath("/")+"excel\"+"empinport.xls";
String fileName="人员批量导入模板.xls";
InputStream inStream = new FileInputStream(path);// 文件的存放路径
response.reset();
response.setContentType("bin");
response.setHeader( "Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("gb2312"), "ISO8859-1" ) );
// 循环取出流中的数据
byte[] b = new byte[100];
int len;
try {
while ((len = inStream.read(b)) > 0)
response.getOutputStream().write(b, 0, len);
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void download() throws Exception {