Monday, December 16, 2002 02:24 AM
Set the content type of the response to "application/ms-word" or something like that (browse the web for the correct MIME type), and write the raw contents of the .doc file to the response's output stream.
Here's a quick example for the JSP, although this kind of "raw" output is definitely better to implement directly as a servlet (because of more strict/clear control over output).
<%@ page language="java" %>
<%@ page import="..." %>
// set the content type so that the browser knows
// what to do with it...
// get a hold of the Word document...
InputStream doc = getWordDocumentStream("foo.doc");
// write the contents of the .doc into response stream