Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Read .xls-file in JSP

843836May 15 2005 — edited May 16 2005
My 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2005
Added on May 15 2005
2 comments
220 views