Regarding saving and opening excel files using servlets
Hi,
I have some data on a jsp.I made an excel file with that data using apache''s POI.Then i have to save the file using a servlet.
I am copying the code below :
All the data which i needed from JSP is wriiten to a ByteArrayOutputStream "baosPDF" using apachs's POI
StringBuffer sbFilename = new StringBuffer();
sbFilename.append("DealerCsa_Report_");
sbFilename.append(System.currentTimeMillis());
sbFilename.append(".xls");
StringBuffer sbContentDispValue = new StringBuffer();
sbContentDispValue.append("attachment");
sbContentDispValue.append("; filename=");
sbContentDispValue.append(sbFilename);
response.setHeader("Content-disposition",sbContentDispValue.toString());
response.setContentType("application/vnd.ms-excel");
sos = response.getOutputStream();
baosPDF.writeTo(sos); // baosPDF is ByteArrayOutputStream whcih
//contains excel sheet
sos.flush();
baosPDF.flush();
baosPDF.close();
So for the above code when i am trying to save the file it is saving but when i am trying to open it i am getting error as
"C:\Documents and Settings\rakeshbh\Local Settings\Temporary Internet Files\Content.IE5\WHAN8HYR\DealerCsa_Report_117945678[1].xls could not be found.Check the spelling of the file name, and verify that the file location is correct."
Can any one please tell me why i was not able to open the file and what should be done to open the file .

