This is indeed the default behavior of IE. It does not use the filename attribute of the Content-Disposition header in any way to prepare the default file name for Save As. Instead, it uses the last piece of request URL path information.
I recommend rewriting servlets and / or links so that the desired file name is provided as part of the request path information, rather than, for example, the request parameter.
So instead
<a href="/pdfservlet">View PDF</a>
or
<a href="/pdfservlet?file=foo.pdf">View PDF</a>
you need to use
<a href="/pdfservlet/foo.pdf">View PDF</a>
When matching the URL pattern /pdfservlet/* with the template, you can, if necessary, capture part of the file name dynamically in the servlet as follows (for example, to find the desired PDF file and / or set the correct filename in the header for more decent web browsers):
String filename = request.getPathInfo().substring(1);
This, by the way, is regardless of whether it served as a built-in or as an attachment.
source share