How can I download a file (for instance, a Microsoft Word document) from a server using a servlet and an applet?

Alex Chaffee

Try telling the applet to call getAppletContext().showDocument("http://foo.com/whatever/blah.doc"). That makes the browser responsible for fetching and saving the document (including putting up the "Save As" dialog).

You may also want to check the web server configuration to make sure the approprate MIME-type configuration is set. If your servlet is the one fetching the document (or creating it on the fly), then it must set the MIME-type using response.setContentType("application/ms-word") or equivalent.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact