url = encodeURI(url);
url = encodeURI(url);
window.open(url,"two.jsp","scrollbars=no,toolbar=no, menubar=no, location=no, status=no"); //弹出新窗口
window.opener=null;
window.open("","_self");
window.close(); //关闭窗口
two.jsp页面内:
String id = request.getParameter("id");
System.out.println("转化之前的1:id=====" + id);
id = java.net.URLDecoder.decode(id,"UTF-8");
System.out.println("转化之前的2:id=====" + id);
这样就ok了,原因就在,
url = encodeURI(url);
url = encodeURI(url);
js 里头window.open(url),url要进行两次encodeURI编码,这样才会得到我要的正确结果。
转自:http://nhy520.javaeye.com/blog/640099