dcsimg
with tomcat link to .xls,.ppt files shows junk char pls help
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   JIGNESH_PATEL
Posted On:   Thursday, June 6, 2002 10:35 AM

I have created one html page in which there are somn links to xls,doc & ppt files.It works fine without any web server.But when this file is deployed in tomcat web server.Doc files opened successfully but xls & ppt files shows junk char. Pls help me.
Thanks
Jignesh


Please use html tags to format code blocks.

Re: with tomcat link to .xls,.ppt files shows junk char pls help

Posted By:   michael_dean  
Posted On:   Thursday, June 6, 2002 11:24 AM

The problem that you're having is that the server (Tomcat) is not reporting the proper Mutipurpose Internet Mail Extensions (MIME) content type for the documents.



You configure the MIME content types by associating them with certain file extensions in the web application deployment descriptor (web.xml). Tomcat 4.0's default deployment descriptor ($TOMCAT_HOME/conf/web.xml) provides mappings for the most commonly-used MIME types--including "application/msword" (which is mapped to all files with the "doc" extension). The mapping looks like:





doc
application/msword



To make Tomcat work with Excel files and Powerpoint files, you will need to specify the content type for the "xls" and "ppt" extensions. You can do so in Tomcat's default deployment descriptor (in which case all web apps on the server will be configured) or in your application's deployment descriptor (making your application portable across all servers) or, better yet, both for good measure.



Note that when you add the mime-type element, you must specify a MIME type that has been configured on the client machine (i.e. associated with a certain program installed on the client machine). Shown below are content types that are normally used by Excel and PowerPoint, but I cannot guarantee that they will work for you.





xls
application/vnd.ms-excel


ppt
application/mspowerpoint



You can always find out what was configured on your machine by looking in Windows Explorer's "Folder Options" on the "Associations" tab (I'm pretty sure those are the correct names--I don't have MS Windows). Remember, though, just because it works for you does not mean that it will work for your users, so make sure you include a "backup plan" allowing them to save it to disk and open it themselves.

About | Sitemap | Contact