httpclient get请求中文参数 tomcat服务器接收 乱码问题

客户端请求(采用utf-8的编码方式):HttpGet request=new HttpGet(url+"?userName="+URLEncoder.encode(userName, "utf-8")+"&password="+URLEncoder.encode(password, "utf-8"));

tomcat服务器:struts2接收总是乱码;

解决:tomcat server.xml  中修改

<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               URIEncoding="UTF-8"

              。。。。。。

猜你喜欢

转载自qihaha.iteye.com/blog/2041318