Hello Priyadharshini,
I've been facing that problem for over a year now. It has a variant: should you change the content type to "application/stream", you would have to click the Open button twice (IE only, Firefox works fine anyways)
. Gladly, I thought of a simple solution a few days ago.
The problem is that IE sniffs the response instead of just interpreting it, so the line that causes bugs to pop out is
To avoid that, IE must think that it requested the file with the name you want. Thus, we need a mapping and a
servlet to deal with that mapping. Suppose we call that servlet FileServerServlet. So you add to your web.xml:
All right, we can fool the browser at the file name. Now, for the servlet implementation. I have used an approach that may not be the most appropriate, but anyway... replace the code that you posted (save it for later) by this:
Another approach would be to send the file path as a request parameter, but I don't like that (it would be displayed in the browser). At last, the FileServerServlet looks like this:
That's it. This solved my problem, and I hope it does the same for you. Best regards
[ September 28, 2004: Message edited by: Henrique Sousa ]