Problem:
In the Tomcat server environment, when you open the browser to download the XLS and rarfile, open it directly in the browser and garbled characters appear.
Solution:
In fact, it is very simple. You only need to add several lines of code to the Tomcat 5.0 _ home/CONF/Web. xml file.
<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>
<Mime-mapping>
<Extension> PPT </extension>
<Mime-type> application/vnd. MS-PowerPoint </mime-type>
</Mime-mapping>
<Mime-mapping>
<Extension> zip </extension>
<Mime-type> application/zip </mime-type>
</Mime-mapping>
<Mime-mapping>
<Extension> RAR </extension>
<Mime-type> application/RAR </mime-type>
</Mime-mapping>
<Mime-mapping>
<Extension> MSI </extension>
<Mime-type> application/Msi </mime-type>
</Mime-mapping>
<Mime-mapping>
<Extension> cab </extension>
<Mime-type> application/CAB </mime-type>
</Mime-mapping>
In addition, the Code can download the mime.txt, Web. xml file, and, don't forget,
1) Restart Tomcat
2) Clear your local ie cache by using the tool-Internet Options-browsing history-Delete.
When you open the RAR file again, it will be downloaded normally.