标签:
function getURIParam(name) { var search = window.location.search; search = search.substring(1); if (search.length < 1) { return null; } var pars = search.split("&"); for ( var idx in pars) { var par = pars[idx]; var keyval = par.split("="); if (keyval.length < 2) { continue; } if (keyval[0].toLowerCase() == name.toLowerCase()) { if(keyval.length == 2){ return keyval[1]; } var res = ""; for(var i=1;i<keyval.length;i++){ res += keyval[i] + "="; } return res.substring(0, res.length - 1); } } return null; }
java代码中传值:
return "redirect:/hq/boss/login?errorkey="+"error";
jsp页面中获取
var errorkey = getURIParam("errorkey");
标签:
原文地址:http://www.cnblogs.com/LIANQQ/p/4816937.html