Read a .dot (MS Word Document Template) from jsp
Hi,
I have a link to a .dot (MS Word document Template file on the jsp page. While trying to access it from a link on the browser, the file is getting displayed in binary format.
If I try a normal word document or excel document, I am able to open/save the document.
I tried adding the following lines in the web.xml too with the same results.
<mime-mapping>
<extension>dot</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
and tried with this also
<mime-mapping>
<extension>dot</extension>
<mime-type>application/vnd.ms-word</mime-type>
</mime-mapping>
Can anybody help me on this ?
Thanks n advance, Sajiv
[794 byte] By [
snkarthaa] at [2007-11-27 2:38:35]

# 1
This is likely a clientside configuration. Rightclick at the link to the .dot file and choose save-as. Then, from the local disk, does it open normally? If not, then you might doublecheck the file associations in the configuration of the operating system. If it just works, then I shouldn't know the cause and the solution :)
Which useragent was you using to download the file tho?
# 2
Hi Balu,
As you had directed, I tried a sample jsp with just the link to the document.When I click on the link, it allows me to open/save the document and the default type it gives is with the extension.doc.
I am able to save the file as a .dot itself.
So, if this is coming from an application in a server, is there any particular reason why it is not functioning properly ?
When you mean by UserAgent, what do you actually mean?
Thanks
Sajiv
# 3
> As you had directed, I tried a sample jsp with just
> the link to the document.When I click on the link,
> it allows me to open/save the document and the
> default type it gives is with the extension.doc.
>
> I am able to save the file as a .dot itself.
>
> So, if this is coming from an application in a
> server, is there any particular reason why it is not
> functioning properly ?
I don't fully understand if the problem is already solved or not?
> When you mean by UserAgent, what do you actually
> mean?
An useragent is just a client application which can access network sources. In this case it is likely a web browser, for example Internet Explorer or Firefox. It might be useful to try as many useragents as possible so that you can exclude the useragent's default behaviour.
# 4
I tried the link in my local environment. I have a sun server running on my local server.In this env, I placed a jsp file and wrote a link that points to a .dot file. This worked and I am able to right click on the link and and save the file and it works normally.
I am using Internet Explorer only.
When the link is from an applicaiton that is placed in a server (not my local host), the file does not open in MS Word. but opens in binary format.I am able to open .doc, .pdf, .txt files from this server.
Anyway, based on my comments, my architect has actually created a .doc file. The cliens are also ok with it :->>
Thanks a lot for your response Balu.
-Sajiv