若对中文编码一次在后台获取会出现中文乱码,编码两次就不会出现乱码

jsp页面:
window.location.href="${pageContext.request.contextPath}/register.do?type=isExist&name="+encodeURIComponent(encodeURIComponent(name));
 
java后台:
String name = URLDecoder.decode(request.getParameter("name"), "utf-8");

你可能感兴趣的:(中文乱码)