Servlet解决中文乱码现象
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
String name=req.getParameter("username"); //先编码
name=URLEncoder.encode(name,"utf-8"); //在译码
name=URLDecoder.decode(name,"utf-8");
//解决中文乱码
name=new String(name.getBytes("ISO8859-1"),"utf-8");