File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Opening a MS Word Document from JSP using Relative URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Opening a MS Word Document from JSP using Relative URL" Watch "Opening a MS Word Document from JSP using Relative URL" New topic
Author

Opening a MS Word Document from JSP using Relative URL

Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
I have this requirement of opening some help documents in MS Word Format.

We have the document placed in the web layer ( along with JSPs) and then we try to access the documents using the relative URL.

The full path gets replaced correctly, but the Word Document is opened in browser in text format.

<A href="/xxxxxxxx/docs/module/document1.doc" >Open A Word Document</A>

I do not have any p roblem in opening any word document from internet and ms word is already in the file types for my computer.

Any thoughts on this ??

Browser - IE 6.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Vicky",
Please check your private messages


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
i changed my display name, per your policy.

Can anybody offer any suggestions for my issue ?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What container are you using?
Does it have a mime type set up for the ".doc" extension?
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
I am using Weblogic Application Server.

I do not have any entries for any MIME type in web.xml.

But it works fine for a PDF File.
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
I added the MIME Types to web.xml and it fixed the issue.

<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>


Thanks for your help
[ October 04, 2007: Message edited by: Vicky Mohan ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't know how Weblogic works but in Tomcat, there is a global web.xml file that contains all of the pre-set mime types.
I'm guessing there is a similar config file in WebLogic.

If you want to pursue it, let me know and I'll move this thread to our BEA Weblogic forum for you.

-Ben
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
Thank you very much. I would really appreciate it.

If we could get it set globally in weblogic, it will be more appropriate.

Please forward this to weblogic group.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening a MS Word Document from JSP using Relative URL
 
Similar Threads
How to create MS Word Doc using HWPF POI
regex between boundary tags
How to Open .doc file with in browser ?
To generate Word Documents
Edit a word document from server