 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

May 4th, 2007, 10:54 AM
|
Registered User
|
|
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to avoid file download box for attachment
I've '[u]view</u>' link, if I click this link, it will go to the servlet and it will open one word document. It is opening the document properly, but while opening the document one pop-up file download dialog box is coming like Open, Save or Cancel button.
After selecting the open button, it is opening the document, instead of this the document should be opend always I click the link.
My requirement is if I click the link it should open the document with file name (myDocument.doc) without any dialog box.
I[u]have tried the following code</u>
I use content-disposition type = attachment, then the file name is coming whatever I have set in the servlet response, but dialog box is coming.
sample code
response.setContentType("application/msword");
response.setHeader("Content-disposition","attachment; filename=myDocument.doc");
If I use content-disposition type = inline, then the file name is not coming and file download dialog box also not coming. :(
sample code
response.setHeader("Content-disposition","inline; filename=myDocument.doc");
Can you please any one help me to achieve my requirement.
Many thanks for your time.
Regards
Mani
|

May 28th, 2007, 09:05 PM
|
Registered User
|
|
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi there,
Did you manage to find the answer for the above problem in the end, as I am wanting to do the same and not sure how to. The only difference is that in my case I would like a link on html page to open an excel file without showing the File Download window(with open, save and close).
Any help would be much appreciated.
Thanks
|

May 29th, 2007, 04:45 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi,
Quote:
quote:Originally posted by Gnanamani
response.setHeader("Content-disposition","inline; filename=myDocument.doc");
|
Try this
response.setHeader("Content-disposition","filename=myDocument.doc");
Regards,
Rakesh
|

June 8th, 2007, 04:09 AM
|
Registered User
|
|
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Rakesh
I have tried like
response.setHeader("Content-disposition","filename=myDocument.doc");
but the file name is not coming, instead of that I am getting the header like go (Read only).
Go is my URL pattern like
<url-pattern>go</url-pattern>
Regards
Mani
|

June 8th, 2007, 08:04 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi,
Sorry! it might be because of the missing quotations. Try giving
response.setHeader("Content-disposition","filename=\"myDocument.doc\"");
I've used syntax similer to the one above.
Regards,
Rakesh
|

December 7th, 2007, 01:42 AM
|
Registered User
|
|
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I'm also facing similar situation. While opening excel I get authentication dialog box even session still alive. I see similar situation you guys faced, did you get any solution and can you guys share your experience pls.
Thanks
Som
|

December 24th, 2007, 06:46 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Som: authentication dialog box is different from the open/save/cancel dialog. Can you be little informative about your problem?
- Rakesh
|
|
 |