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(""). 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.

About | Sitemap | Contact