This specific header:
"Content-Disposition","attachment;filename=Report.xls"
tells the browser to download the file as an attachment with the default name Report.xls .
Also check HTTP / 1.1 specifications.
The Content-Disposition response header field was suggested as meaning that the source server will offer a default file name if the user requests to save the contents to a file.
An example is
Content-Disposition: attachment; filename="fname.ext"
The receiving user agent MUST NOT observe any directory path information is present in the filename-parm parameter, which is the only parameter that is believed to be applicable to HTTP implementations at present. filename MUST only be considered a terminal component.
If this header is used in a response with an application / octet-streaming content type, the implied assumption is that the user agent should not display the response, but directly enter the save response as ... ".
Remember, though , HTTP / 1.1 defines the Content-Disposition response header field, but indicates that it is not part of the HTTP / 1.1 standard.
IMHO, do not use JSP to download files, use Servlet! Instead
source share