Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 4th, 2007, 10:54 AM
Registered User
 
Join Date: May 2007
Location: , , .
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


Reply With Quote
  #2 (permalink)  
Old May 28th, 2007, 09:05 PM
Registered User
 
Join Date: May 2007
Location: , , .
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

Reply With Quote
  #3 (permalink)  
Old May 29th, 2007, 04:45 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
  #4 (permalink)  
Old June 8th, 2007, 04:09 AM
Registered User
 
Join Date: May 2007
Location: , , .
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


Reply With Quote
  #5 (permalink)  
Old June 8th, 2007, 08:04 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
  #6 (permalink)  
Old December 7th, 2007, 01:42 AM
Registered User
 
Join Date: Dec 2007
Location: Sunnyvale, CA, USA.
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


Reply With Quote
  #7 (permalink)  
Old December 24th, 2007, 06:46 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:02 AM.


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