让tomcat支持中文Url传递

打开tomcat/conf/servel.xml
修改(黑体字为修改部分)
<Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" URIEncoding="GBK"/>
在web页上把含有中文的url用java.net.URLEncoder.encode("中文")处理
例子:
<c:set var="test">
  /<%=java.net.URLEncoder.encode("用jsp实现文件上传.pdf")%>
</c:set>
<c:redirect context="/ebooks" url="${test}"/>

链接传递中文参数例子:<a href=hello.jsp?send=<%=java.net.URLEncoder.encode("中文")%>> 点击</a>

jspsmartupload组件下载中文例子:

<%@ page contentType="text/html;charset=gb2312"
import="com.jspsmart.upload.*" %><%

SmartUpload mySmartUpload  = new SmartUpload();

//String path=request.getParameter("中文");修改server.xml后
String path = new String(request.getParameter("中文").getBytes("ISO-8859-1")); //修改server.xml前
// Initialization
mySmartUpload.initialize(pageContext);
// Download file
//mySmartUpload.downloadFile("/upload/sample.zip");
// With a physical path

mySmartUpload.downloadFile(path);
response.getOutputStream().close();
// With options
// mySmartUpload.downloadFile("/upload/sample.zip","application/x-zip-compressed","downloaded.zip")
%>

原文地址:https://www.cnblogs.com/huhu/p/121049.html