Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

File download dialog box problem!

843835Mar 24 2002 — edited Aug 28 2007
Dear everbody
How do you force file download message box to use specified file name instead of JSP or servlet name.?
I am using the following code:
file1.jsp
..
frmlist.action = "download.jsp";
frmlist.submit();
..
download.jsp
...
String fileName = "inventory.xls";
Disposition","attachment;filename=\"inventory.xls\"");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/msexcel");
...
With the above code, browser first pop up file download dialog box informing
'You are downloading the file:[download.jsp] from host. Would u like to open the file or save?'
I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the jsp name

i have read all forum topic and tried every way, question still exists, maybe i forget any important set or something. hope to get your tips!
Thanks

Luke




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2007
Added on Mar 24 2002
17 comments
663 views