The below code works fine but when I try to add response.getOutputStream and pass this to wb.write so that when somebody goes to the jsp page it will popup a dialog box for them to download the excel spreadsheet automatically. The problem is I cann't use printWriter and outputstream at the same time....
OK , I also have this servlet. That seems to popup the download .xls box put when you download it and open it... it say's that the data is corropt or not in the correct format.
What is going wrong
If I use FileOutputStream instead it creates the file in the C:\workbook.xls.... but I want it to not create it but physically popup a download box so the person can download it/save/open it anywhere he wants.
What is going wrong with OutputStream out = response.getOutputStream();
Thanks for any help.... The apache pio stuff seems to work fine in regular java projects but a dynamic web project using jsp and servlets is where it is not working as well.
it say's that the data is corropt or not in the correct format.
I have found that when I get this message that it means just what it says. If you are using MS Excel then try opening the downloaded file with OpenOffice Calc. I have found that sometimes I have problems Excel but not in Calc. You could also try changing or simplifying your test spread sheet even more to see if that makes a difference.
Joined: Mar 22, 2005
The GET method doesn't do anything useful (it returns nothing to the browser). Is the error message happening when you're doing a POST?
By the way, you should never have a constructor in a servlet.