This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am creating an excel sheet and storing it in application server which runs on HP-UNIX OS. I want to download that excel sheet using jsp page. I tried the following code, but its giving the page cannot be displayed error. Is there any other way to download the excel sheet from jsp page. <% out.println("<a href=\"../XlsDownload/Download.xls\">Download</a>"); %>
the above will also work, but you may want to replace the 'x-download' with the specific format for excel files. i dont know what that is.
the difference would be that, browsers that recognise the format will open the file for you in Excel automatically while others will show the 'save as' or equivalent dialog box.
Joined: Mar 30, 2005
In this case, the code in the above post will set the content type. But when you set te content type as above, that means that you want to download the file specified by 'fileName'. And then you use the OutputStream of the servlet to stream the actual bytes of the file. So, the effect of the above code is to produce the 'save-as' pop-up dialog box and save the file onto the client.