• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Opening DOC files

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic