Accessing POI generated Excel from client

We are trying to export data from jsp to excel. As there is problem with size of excel being downloaded, we are using POI which solved our problem of memory and time taken to download. But now we are not able to access the file from the client. The problem is as follows.

We are placing Excel file in "C:\\temp\\reportResult.xls" (Outside the EAR folder structure) and accessing it from the application. It is working if the server and client are same. If the client is remote machine, we are not able to open the file, as client does not have access to server machine.

We tried by placing the excel file in shared folder and accessing it using system name. But this is not working. It is opening a blank file.

If we place the file in server context path(inside EAR folder and accessing with http://servername:port/applcontext/.../ reportResult.xls), it is working. But because of some specifications we can not place this file in EAR directory structure.

Is there any other way to access the POI generated excel file(placed in file system of server otherthan context path) from the client抯 browser?

Any help is greatly appreciated.

[1170 byte] By [Swathia] at [2007-10-2 0:44:44]
# 1

> Is there any other way to access the POI generated

> excel file(placed in file system of server otherthan

> context path) from the client抯 browser?

If you check the POI API for HSSFWorkbook, there is a method called write() which take an outputstream as an argument. You could try passing the outputstream from response (HttpServletResponse).

Don't forget to add the following lines -

response.setContentType("application/vnd.ms-excel");

response.setHeader("Content-Disposition", "attachment; filename = blahblahblah.xls");

Annie.a at 2007-7-15 16:59:38 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 2
Anyway, you should have asked this in the servlet forum. :)
Annie.a at 2007-7-15 16:59:38 > top of Java-index,Other Topics,Java Community Process (JCP) Program...