Search code examples
excelexportjxls

Hyperlink to download excel using jxls


First the context:

I am using jxls to export to an excel using an excel template & its working fine.I am saving to a folder under webcontent

WebContent\reports\report_output.xls

What additionally i need to do:

I have to provide a hyperlink to the user in the webpage that will access this saved file.

What i am failing to do:

The hyperlink is throwing exception (resource not found) if i don't refresh my web-content in eclipse

My questions

a. Refreshing a webcontent through java & isit nessarily the way out to this situation? b. Alternative approach keeping in mind i cant do the following

1.cant use a spring mvc framework(time & effort constraints) and stick with jxls only.

2.can't save the file in local drive and access through hyperlink for security reasons.


Solution

  • I figured it out using using a particular URK pattern the servlet will respond back after copying the content and streaming back with mime type as XSL. here is the working example: "Exporting To Excel: JXLS".