I am reading a txt file and writing it into excel file, but while making it as downloadable excel file it is not writing any data to excel and giving showing this message
Your writeDataToExcelFile
method writes the Excel data into a FileOutputStream - this is not connected to the response OutputStream.
You should update the writeDataToExcelFile
method to include another parameter:
private void writeDataToExcelFile(String string,
ArrayList> excelData,
OutputStream outputStream)
and the writing of the data, change to this:
myWorkBook.write(outputStream);
This should then permit the myWorkBook object to write back to the browser.
Also, change the line that calls the method to:
writeDataToExcelFile("praveen",exceldata, response.getOutputStream());