I have an requirement of generating two excel files at once. We are using Apache POI for generating excel files and struts framework.
Within the action class, the steps are like,
OutputStream outputStream = response.getOutputStream();
and then populate data from db and created one file using POI and called,
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=ExportFile1.xls");
workbook.write(outputStream);
outputStream.flush();
and followed same steps(populate data from db, write excel content) for second file as,
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=ExportFile2.xls");
workbook.write(outputStream);
outputStream.flush();
But only one file is generated.
Is this possible in java to generate two files at once? Have anyone implemented this?
Pls note: Generating two sheets within one excel file is not required.