URL传中文参数引发的乱码问题
解决方法如下:
1.在JS里对中文参数进行两次转码
var login_name = document.getElementById("loginname").value; login_name = encodeURI(login_name); login_name = encodeURI(login_name);
2.在服务器端对参数进行解码
String loginName = ParamUtil.getString(request, "login_name");
loginName = java.net.URLDecoder.decode(loginName,"UTF-8");