Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
|
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
 
Old May 4th, 2007, 10:54 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


 
Old May 28th, 2007, 09:05 PM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old May 29th, 2007, 04:45 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old June 8th, 2007, 04:09 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old June 8th, 2007, 08:04 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old December 7th, 2007, 01:42 AM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old December 24th, 2007, 06:46 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Som: authentication dialog box is different from the open/save/cancel dialog. Can you be little informative about your problem?

- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to avoid duplicate contacts? combo box? dstein4d Access VBA 5 February 26th, 2008 05:55 PM
File attachment like as in gmail Sasikn75 Flash (all versions) 1 January 5th, 2007 12:39 AM
Smaller download/single download file available jminatel BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 21st, 2005 11:10 AM
How Avoid Dialog Box Open/Save Files see07 ASP.NET 1.x and 2.0 Application Design 4 February 23rd, 2005 07:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.