File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Open/Save attachments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Open/Save attachments" Watch "Open/Save attachments" New topic

Open/Save attachments

Deboshree Roy

Joined: Oct 03, 2007
Posts: 21
I want to introduce a functionality in my application, in which an attachment when clicked on a JSP page should open the Open/save dialog box. and On clicking Open, the pdf should open.
I am writing a servlet for this. The code in the servlet has the following lines:

response.addHeader("Content-disposition","inline; filename="+fileName);

Now when I click on the attachment link....It first opens me a bank window then opens the open/save dialog box. On clicking Open I am able to open the pdf file or when I click save I am able to save the document to local system.
However I dont know how to remove the blank window that is opening up when I click on the attachment.

Please advise if anyone has encountered similar scenario. I am using IE6.
Manish Singh
Ranch Hand

Joined: Jan 26, 2007
Posts: 160
try href with the target attribute
I agree. Here's the link:
subject: Open/Save attachments
Similar Threads
save as dialog problem
while opening csv file, dialog box opens twice
Adobe Acrobat gives error to open programmatically generated pdf attachment.
When i try to open pdf, it shows 'There was an error opening this document.' message
How to set the default file name shown when trying to save PDF opened in inline view from browser ?