JSP中文乱码问题的解决方案

3/8/2017来源:ASP.NET技巧人气:3329

1.request get: String value = request.getParameter("username"); byte[] buf = value.getBytes("ISO8859-1"); value = new String(buf,"UTF-8"); post: request.setCharacterEncoding("UTF-8"); value = request.getParameter("username"); 2.response response.setContentType("text/html;charset=UTF-8");