jsp URL中文传值

js中,讲中文转码

  encodeURI(中文);

Java中,转回中文

  java.net.URLDecoder.decode(乱码,“utf-8”);

例子;

  window.location.href = "QuanXian2.jsp?JueSeName="+encodeURI(JueSeName);

  String JueSeChuan = java.net.URLDecoder.decode(request.getParameter("JueSeName"), "utf-8");

参考百度的:

javascript: 
  encodeURI(value):将value转换成utf-8,
  decodeURI(value):将utf-8的value反转成字符串。
java:
  URLDecoder.decode(value, "utf-8"); 将乱码转回
  URLEncoder.encode(value, "utf-8"); 将中文转码
上一篇:supervisor+gunicorn部署python web项目


下一篇:JavaScript 中定义变量时有无var声明的区别