http://blog.csdn.net/sccemstanford/article/details/9064155
————————————————————————————————————————————————————————————————————————————————
Recently done Jeecms project found using IE9 download files (doc,docx etc.), the browser sometimes directly open the file display garbled sometimes can download but after downloading is a folder is inside a bunch of XML files (Microsoft Office Store file information mainly in XML file storage), Later the trace code discovery background default is to output the file in text format, and then open the Web. xml file Discovery
< mime-mapping > < extension >doc</extension> <Mime-type >application/zip</mime-type> </ Mime-mapping>
, when I downloaded the doc file, the default is downloaded as a zip document, no wonder sometimes the downloaded file as a bunch of XML files, so reconfigure some of the popular document download MIME format, and see the <mime-mapping> The role of the--mime-mapping element maps MIME types to extensions, which are used to specify the download format for this record:
<!--automatically assemble the appropriate MIME suffix for the downloaded file - <mime-mapping> <extension>Doc</extension> <Mime-type>Application/vnd.ms-word</Mime-type> </mime-mapping> <mime-mapping> <extension>Xls</extension> <Mime-type>Application/msexcel</Mime-type> </mime-mapping> <mime-mapping> <extension>Ppt</extension> <Mime-type>Application/vnd.ms-powerpoint</Mime-type> </mime-mapping> <mime-mapping> <extension>Docx</extension> <Mime-type>Application/vnd.openxmlformats-officedocument.wordprocessingml.document</Mime-type> </mime-mapping> <mime-mapping> <extension>Pptx</extension> <Mime-type>Application/vnd.openxmlformats-officedocument.presentationml.presentation</Mime-type> </mime-mapping> <mime-mapping> <extension>xlsx</extension> <Mime-type>Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</Mime-type> </mime-mapping>
<mime-mapping> in the Web. xml file;