Yes it is possible. The only thing you need to change in the code below is the MIME type. Keep in mind that the code below was written to stream PDF files. I didn't bother going through and changing the code to state that it is for Word files. So you'll see PDF referrals throughout the code. Anyway.. back to what I was talking about. Below you will need to change one line. The new line of code will be...
The great thing about the file streaming is that it comes up fast even w/larger files. I have 35 page documents come up very quickly. If you wanted to read Excel Spreadsheet programs you would change it to be....
Remember if you do this, the plug in must already be on the system for the browser to responde. I put some comments in the code showing you how to have the document come up in the browser window or in a seperate window.
This code will probably sit in its own
servlet. This method will be called by doGet or doPost depending on how you call it. From the signature of the code you can see I pass in the page to be dispatched. The pdf will be found from the root of the web directory.
I call my PDFServlet dispatcher by the following line...
http://localhost:8080/PDFServletController?pdfFileToDispatch=az_v1_va_simple_packet.pdf In this code, the PDF files are referenced from the web root. So when you call the PDF files.. or you in your case your word files, you will need to start at / which will be server/web/. I put my files all under web/pdf/ Inside my code I hide the fact that I'm in 1 directory deeper inside of the pdf directory. Anyway.. give that a shot.. any questions, email me at
[email protected] Dale
[ August 22, 2002: Message edited by: Dale DeMott ]