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 Opening DOC files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Opening DOC files" Watch "Opening DOC files" New topic
Author

Opening DOC files

El Durango
Greenhorn

Joined: Oct 09, 2003
Posts: 23
Hello
I have a servlet which will open up a word document when given the URL for a doc file located on the server. However I would like it so that if the document URL is invalid it would display an HTML error page, however it still opens up Word and displays the error info there. I have a solution to this however it would require me to create a seperate JSP page to handle the errors. I am wondering can the servlet handle handle both Word docs and display error info on the browser.
I set the servlet content type to open up the responses in the MSWord app.
is there another way around this?? Do I have to redirect the response to a seperate JSP page to handle errors??
here is the line I mentioned:
Sudhir Howale
Greenhorn

Joined: Aug 18, 2003
Posts: 4
Hi!
Cant you set the response type depending on the validity of the URL. I mean to say, if you want to throw a normal HTML error page then you can not set the repsonse type as (application/msword).
I havent seen your code, but the flow should be
if(valid(URl) then { normal processing }
else ( set the response type as html and throw html error page }
Do write me , if i have misunderstood something...
Sudhir H
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Sudhir is saying that somehow you have to be able to determine if the URL is valid or not before attempting to open the word doc. Based on your posting, it seems like you are determining that the doc URL is invalid if the doc can not be found.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening DOC files