I have created a submit button,on the click of which an excel report is created with the business data at a location on local hard drive.On click of submit,the file generated at hard disk location is proper with correct data.However,the requirement is to open that excel sheet on click of submit.The file when it opens on click of submit has junk characters inside it.
JSPs are meant for textual output (like HTML); you can't use them for streaming binary data like XLS files. You'll need to use a servlet instead. (Also note that the code is streaming the file one byte at a time - which is very inefficient.)
Joined: Nov 27, 2007
Thanks for the reply!
I have replaced the jsp with servlet .
The servlet which replaced the jsp:
Now on click of submit I cannot open the xls.It gives error on loading error message:
Missing file: C:\Documents and setting\...\Desktop\css\style.css
Please help! I don't where I am going wrong
Joined: Mar 22, 2005
This can't really be the code you're using, can it? You'd get a NullPointerException. It should be something like