File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
Similar Threads
jsp page contents in the word document
How to create MSWORD doc and open the doc in jsp?
"mailmerge" to WORD doc and automatically print?
Is it possible to open a word document in client side by javascript?
Can java send command to keyboard???