在jsp的请求中 都参数且有中文
Action处理
window.location=encodeURI('<%=basePath%>admin.do?method=login&adminname='+textname+'&password='+textpassword+'&roleid='+roleid+'');
Action处理
String adminname = new String(request.getParameter("adminname").getBytes("ISO-8859-1"),"UTF-8");
String password = new String(request.getParameter("password").getBytes("ISO-8859-1"),"UTF-8");
String roleid = URLDecoder.decode(request.getParameter("roleid"), "UTF-8");
本文介绍了一种在JSP中处理包含中文字符的URL参数的方法。通过使用特定的编码转换,确保了从请求中获取的中文参数能够正确解析。文章详细展示了如何在JSP页面上设置请求的URL,并在后端Action中对参数进行解码。
1万+

被折叠的 条评论
为什么被折叠?



