servlet中文亂碼怎么解決?
response.setContentType("text/html;charset=UTF-8;pageEncoding=UTF-8");這個要在servlet的方法中的第一行,你先進行response的轉換就可以了,改成response.setContentType("text/html;charset=UTF-8;pageEncoding=UTF-8");//放到這PrintWriter out=response.getWriter();//從這里response.setCharacterEncoding("UTF-8");out.println("");out.println("
");out.println("Simple servlet");out.println("中國");out.println(" ");