Two Laptop Bag*
The moose likes Servlets and the fly likes open word from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "open word from a servlet" Watch "open word from a servlet" New topic
Author

open word from a servlet

Per Lovdinger
Ranch Hand

Joined: Jun 11, 2001
Posts: 35
Hi,
This is the scenario:
- the user submits a form and activate a servlet
- the servlet writes a file ( a word document) to disk
- now I want the servlet to open the word document....
How do I do that ?
- I've tried with a forward request, but that only displays the content in the browser, I want to open the document in word.
thanks in advance
....Per
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hi ,
Check out if this is what u wanted.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.*;
public class postRecieved extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
{
res.setContentType("application/msword");
PrintWriter pw=res.getWriter();
pw.println("Sandy how are u doing ");
pw.close();
}
}

------------------
Try and Try Till u succeed
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open word from a servlet