JS中用encodeURIComponent编码,后台JAVA解码

JS中用encodeURIComponent编码两次

var p = {};
p.Map = [{f : 'customNo', t : '客户编号'},{f : 'customName', t : '客户名称'}];
var param = JSON.stringify(p);
var url = "http://localhost:8080?data=" + encodeURIComponent(encodeURIComponent(param))
window.open(ulr);

JAVA中解码

String data = request.getParameter("data");
data = java.net.URLDecoder.decode(data, "UTF-8");
posted @ 2021-04-08 15:14  岁月淡忘了谁  阅读(1249)  评论(0编辑  收藏  举报