【发布时间】:2018-10-22 23:26:28
【问题描述】:
在How to export data in CSV format using Java? 中,我找到了将日期写入 CSV 文件的解决方案,并且接受的答案工作正常。
我需要将文件名更改为 .csv 扩展名。现在我将 WebServlet 名称作为文件名,没有任何扩展名。
您知道如何设置文件名吗?
resp.setContentType("application/csv");
PrintWriter w = resp.getWriter();
w.println(generateCsvFile(policies));
w.flush();
w.close();
【问题讨论】: