已经能导出了,只是路径是写死的,怎么修改才能 出现可以选择保存路径的框? 望指导!
以下是部分代码::
String fileName = "硬件查询信息.xls";
fileName = new String(fileName.getBytes("GBK"), "iso8859-1");
response.reset();
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);// 指定下载的文件名
response.setContentType("application/vnd.ms-excel");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
// OutputStream output = response.getOutputStream();
FileOutputStream bufferedOutPut = new FileOutputStream ("C:/硬件查询信息.xls");
最后关闭的代码::
try{
bufferedOutPut.flush();
wb.write(response.getOutputStream());
bufferedOutPut.close();
}catch (IOException e) {
e.printStackTrace();
} finally {
Exportlist.clear();
}
This saving path is selected in the browser settings. The process of sending the response to the browser and then downloading it is controlled by the browser.
The download path is determined by the browser.
You need to find other ways to solve this situation. . . Download