本人已經生成了一個csv文件,到時如何把它導出,我寫的測試時,response.getOutputStream()報空指針異常
finalOutFile = new File(fileName);
instream = new FileInputStream(finalOutFile);
outstream = response.getOutputStream();——這一行報空指針異常
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode(finalOutFile.getName(), "UTF-8"));
response.setContentLength((int) finalOutFile.length());
System.out.println("===================" + finalOutFile.length());
response這個對象是不是為空