The "Save as" dialog box is not displayed when the browser opens the file such as XLS and RAR downloaded by the Tomcat server.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.