• 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

how to open a document in word application using servlet

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can we open an existing named file (e.g abc.doc) in word application,not in browser,using servlet.when i try to do this i get security related message.because when we open word application in normal way then it is Winword.exe file that run,not Winword.doc file.on the other hand i'm trying to open abc.doc file in its application program,remeber not in browser.
thanks in advance.
khurram mirza.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the "content-disposition" header - it may (under Internet Explorer, at least) have an option to do what you want.
 
khurram mirza
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is the "content-disposition" a part of request or response header.where can i check this header?
khurram mirza.
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a response header. Use like this:

The "inline" option means to open within the browser. In IE, you can edit the document - the browser simply becomes the Word parent frame, but it doesn't set up the familiar menu and toolbar stucture as it would if Word had launched externally.
For more info on the Content-Dispostion header, I recommend you search the Web using Google or whatever engine you are most comfortable with.
 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, did you mean PDF file through your snippet? I checked out the Content-Disposition header on google. Interestingly, one of the posts on one site suggested
response.setHeader("Content-Disposition" , "Mohammed; filename=\"MailingLists.pdf\"");
The post, whose name is Mohammed, went as far as saying we can use our own name in place of Muhammed. Some other posts said we can use
response.setHeader("Content-Disposition" , "attached; filename=\"MailingLists.pdf\"");
What does the first field of the second parameter in response.setHeader() do?
Thanks
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whoops! I had a 1 in 3 chance of getting it right. You're correct - my snippet was for a PDF document, but I think you can tell what you'd have to to for Word.
This may help: http://www.faqs.org/rfcs/rfc1806.html
There's a known bug in content-disposition handling for some versions of IE, BTW.
 
khurram mirza
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tim,is there any possiblity that the file opened in browser from server is saved after modification and it is saved to server from where it is downloaded.apprenetly it is not possible because when save option is clicked the dialogue box appeared to save it on client site.but i have to save it on server side by using save option(not 'save as' because file name can be chenged with this).
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's tricky. As I've said here before, a web server is not a file server. Since you're working with a Word document, you might want to see if you can create a VBA macro in the document that causes it to be posted to a file upload servlet or JSP.
I've never tried such a thing, but it's a fairly good bet. It's not likely that Word or Windows is going to have a security barrier to stop you
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic