java,poi导出excle 代码如下,怎么修改才能 出现‘’保存路径的选择框‘’?
迷茫
迷茫 2017-04-18 10:33:39
0
2
397

已经能导出了,只是路径是写死的,怎么修改才能 出现可以选择保存路径的框? 望指导!

以下是部分代码::

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();  
        }      

    
           
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
洪涛

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!