Read .xls-file in JSP
843836May 15 2005 — edited May 16 2005My problem is this:
I have a jsp page that should open a template spreadsheet and make
some changes and the show it to the user. Everthing works but I have
to put the template excel-file in the /bin directory of the server
program, tomcat. The jsp-file cannot find the file if it lies in the
main web application directory(I've tried it in the web-inf, lib and
classes directory aswell). I uses a spreadsheet api called JExcelAPI, if someone wounders...
This is the basic code I use in the jsp-file:
response.setContentType("application/vnd.ms-excel");
OutputStream excelOut = response.getOutputStream();
Workbook workbook = Workbook.getWorkbook(new File("temp.xls"));
WritableWorkbook copy = Workbook.createWorkbook(excelOut, workbook);
The problem lies on line 3 where the file is read.
I've tried it as a servlet too but the didn't fix the problem.
What am I doing wrong? Why can't the JSP file locate the temp.xls if it just lies in the web application directory?
Thanks / Daniel