jsp页面中url传参到后台出现乱码解决方案
2017-08-03 17:44
351 查看
在使用get方式URL中传递中文,到后台会出现乱码的情况。中文字符变为"?"
如:我的jsp页面代码为:
<a href="${_currConText}/lhRanking/ranking.do?investors_code=${inves.investors_code}&investors_name=${inves.investors_name}">查看龙虎榜</a>
传到后台后发现中文字符变成了"?"
我的解决方案有两种
方案一:修改tomcat的server.xml文件,添加一项参数URIEncoding="UTF-8"
<Connector URIEncoding="UTF-8"connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
然后重新启动服务器就好了
方案二:在后台做转码
try {String str = new String(investors.getInvestors_name().getBytes("iso8859-1"),"utf-8");System.out.println("investors_name="+str+"======");} catch (UnsupportedEncodingException e) {// TODO Auto-generated catch blocke.printStackTrace();}
相关文章推荐
- 前台jsp页面向后台传汉字出现乱码问题解决办法
- jsp页面向后台传值出现乱码的问题
- javascript通过url向jsp页面传递中文参数导致乱码解决方案
- 将html页面转为jsp页面出现乱码问题解决方案
- 页面jsp编码utf-8,传递中文参数到java后台出现乱码
- servlet通过URL传参到jsp页面出现乱码问题的解决
- JSP页面出现中文乱码的两种解决方案
- 关于JSP页面getparameter中文出现乱码解决方案
- JSP页面传参出现中文乱码的解决方案
- jsp页面中内部的js弹出中文出现乱码解决方案
- JSP页面与JSP页面之间传输参数出现中文乱码的解决方案
- jsp页面 URL传中文参数到Action里面出现乱码
- (转) jsp页面 URL传中文参数到Action里面出现乱码
- jsp页面向后台传值出现乱码的问题
- javascript通过url向jsp页面传递中文参数导致乱码解决方案
- 汉字从页面传递到后台出现乱码,解决方案
- Jsp页面通过href拼接url向后台传中文乱码问题
- jsp页面中带有iframe页面进行后台传值出现中文乱码
- jsp页面转后台,出现中文乱码