I'm looking for a good example which explains how to download files from the server side of a web app created with Struts 1.1 and JSP;
I tried to follow some tips like this:
Best download file with struts 1.1 method
https://www.mkyong.com/struts/struts-download-file-from-website-example/
I can create the file, put it in the HttpServletResponse and correctly open it through the message that appears from the browser (I have to use IE11, unfortunately), but after opening (or closing) the .xls file, the page remains locked while loading.
I have found that the page remains blocked as soon as the message opening the excel file appears.
This is part of my code in the Action:
OutputStream out = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=ExcelSheet.xls");
FileInputStream in = new FileInputStream("ExcelSheet.xls");
byte[] buffer = new byte[4096];
int length;
while ((length = in.read(buffer)) > 0){
out.write(buffer, 0, length);
}
in.close();
out.flush();
//others insignificant lines of code
return null;
and this is the message that appears on the browser:
As soon as this message appears, the page keeps loading infinitely.
How can I stop the infinitely loading?