url传参中文乱码

来源:互联网 发布:腾讯数据分析待遇 编辑:程序博客网 时间:2024/05/22 00:01

利用action 中的url传中文参数出现乱码

如:supervision!showSupervision.action?type=1&accusedName=${requestScope.deliveryman}&customerNo=${requestScope.customerNo}

其中accusedName的值是中文

在action获取String accusedName = request.getParameter("accusedName");会出现乱码

解决办法

获取时用:String accusedName = new String(request.getParameter("accusedName").getBytes("ISO-8859-1"),"UTF-8"); 

这样就不会出现乱码了

0 0