前端js要编码:
keywordCondition += "d.d18=" + encodeURIComponent($("#searchkey").val())+ "&";
后端解码:
searchKeystr = java.net.URLDecoder.decode(jParam.getSearchKeys(), "utf-8");
js获取地址栏参数
var orderCode = getURLParamValue('orderCode');//"GZ20150601105025";//
前台:
- URI的编码与反编码
encodeURI() 结果 "http://www.packtpub.com/src%20ipt.php?q=this%20" decodeURI
encodeURIComponent() 结果 "http%3A%2F%2Fwww.packtpub.com......" decodeURIComponent
后台:
String userName = URLDecoder.decode(user.getUserName(),"UTF-8");
转载于:https://blog.51cto.com/hebinteng/1974104