//处理Request
request.setCharacterEncoding("utf-8");
String name = request.getParameter("username");
String newName =new String(name.getBytes("iso-8859-1"),"utf-8");
System.out.println("您输入的是:"+newName);
//处理Rsponse
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
转载于:https://my.oschina.net/u/1861097/blog/404266