首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

tomcat上get方式提交请求乱码解决方法

2012-07-20 
tomcat下get方式提交请求乱码解决办法方法1. String name request.getParameter(name)byte[] bs na

tomcat下get方式提交请求乱码解决办法
方法1.

String name = request.getParameter("name");byte[] bs = name.getBytes("ISO-8859-1");name = new String(bs,"UTF-8");

方法2.

1) 打开tomcat的server.xml文件,找到区块,加入如下一行:
URIEncoding=”GBK”
完整的应如下:
<Connector
port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="GBK" />

2) 重启tomcat,一切OK。

参考:http://www.blogjava.net/liuwentao253/archive/2006/12/20/89023.html

热点排行