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!

Link to *always* show Open/Save dialog

843841Jan 21 2005 — edited Feb 22 2005
A servlet forwards to a JSP page. In this page there is a link to a file.
I want that, when the user left-clicks the link, the Open/Save dialog box is always displayed, regardless of whether the MIME type of the file is a known one or not.
The browser should never try to directly open the file; it should always ask "Open/Save?".

How do i do that ?

I tried to set the "content-disposition" header of the Response to "attachment; filename=[myFileName]" in the servlet that forwards to the page containing the link, but this seems to make a download window appear already when sending the page to the browser, before any user's intervention.

Instead, i'd want that the page is sent normally to the browser which will normally display it, and the Open/Save dialog should only appear when the link is left-clicked.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 22 2005
Added on Jan 21 2005
9 comments
2,559 views