Chinese file 404 problems when Tomcat accesses URL (UTF-8) Encoding

Source: Internet
Author: User

CodeAs follows:

<SCRIPT type = "text/JavaScript" src = "javascript/<% = java.net. urlencoder. encode (listjs. get (I), "UTF-8") %> "> </SCRIPT>

On a server written by a colleague, you can access the server normally, but you cannot access tomcat. It is always 404. It takes a long time to solve the problem ..

The solution is as follows:

Modify Tomcat's server. xml file (this solves the problem that files and images containing Chinese characters cannot be downloaded or displayed ):
<Connector Port = "8080" maxthreads = "150" minsparethreads = "25" maxsparethreads = "75" enablelookups = "false" redirectport = "8443" acceptcount = "100" DEBUG =" 0 "connectiontimeout =" 20000 "disableuploadtimeout =" true "uriencoding =" UTF-8 "/>

Uriencoding = "UTF-8" with this sentence can recognize Chinese files, that is, not only can display Chinese in JSP, you can also download display!

In addition to Uri contains Chinese, you can add usebodyencodingforuri = "true" after uriencoding = "UTF-8 "!

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.