request:乱码问题

//已post方式提交
request.setCharacterEncoding("UTF-8");
String name=request.getParameter("username");
System.out.println(name);
//已get方式提交
String name1=request.getParameter("username");
name1=new String (name1.getBytes("iso8859-1"),"UTF-8");
System.out.println("name1-->"+name1);

 

 

posted @ 2017-03-22 16:52  贱贱的小帅哥  阅读(86)  评论(0编辑  收藏  举报