after days reading in the net i still have a problem and hope someone of you guys can help me.
I wrote a simple download servlet called SaveCSVServlet.java which looks like this:
Just the normal way i think.
So the servlet is working well in Firefox,Chrome etc. but not in Internet Explorer
When the save file dialog pops up the filename looks like:
test.csv or whatever.csv... so just normal and i can download the file.
When it comes to the Internet Explorer the filename looks like:
So this is obvious the url of the servlet call and not the filename.
I tried all that i could find with response.setHeader and setContentType, nothing works.
Has someone any idea how i can solve that, or what is a better way to do it.
I'm rather confused about your question. You showed us a lot of code, but as far as I can see you are complaining that the value of
is sometimes not what you are expecting. Am I right?
Edit: wait a minute, that can't be all of it because you also have this code:
Ivan Jozsef Balazs wrote:As if IE (at least some version ) would give the absolute path name along with a file when uploading a file in contrary to other browsers which give just the file name (without path).
This issue has nothing to do with uploading files.
In the servlet the variable filename has the right value at all times (i debugged that).
Then i flush the outputstream and when it comes to the file download dialog, the filename is corrupted, only when i use IE, but as well not every time.
Like i have written in my first post, normally filename should look like this: Hochzoll_Indikatoren.csv .... for example
but sometimes (not every time) it looks like the url of the next call, like main_jsp?mode=Detailansicht5and5area=Stadt5and5indi=Durchschnittsalter5and5id=A5and5detailView=true&fileName=Detailansicht_Stadt_A_Bielefeld_2013
So this is obviously not a .csv file.
The question is why this happens, because it is the same function for every file download and it is working well in all other browser all times.
I found out where to set UTF-8 URL-encoding in JBoss so this is quit old and not necessary any more, just forget about that.
posted 5 years ago
I forgot to mention,
even when i use a fix filename for the .csv file, like test.csv or something the phenomenon exists. So it has nothing to do with the filename.
posted 5 years ago
I just want to let you know that i found the source of this problem.
As i mentioned, it was no problem for all browsers except of IE.
I think IE has problems with some characters in the url, or with the actual length of it, i am not sure about. It is not that the url extended 2000 chars.
So i changed the call to:
where addHidden function looks like this:
This solved the problem for me.
I hope it will help someone else.
On top of spaghetti all covered in cheese, there was this tiny ad: