webservlet 3.0 - utf8 url模式

时间:2014-10-20 08:09:48

标签: servlets tomcat7

如何使用utf8 url for webservlets?

@WebServlet("/nonlatinchars")

例如:

@WebServlet("/руский")

PS。我对utf8参数值没有问题。

webservlet 3.0,tomcat7

1 个答案:

答案 0 :(得分:0)

URIEncoding="UTF-8"
在tomcat的server.xml中添加了

,重启tomcat,问题解决了

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>