gistfile1.txt 方法一 response.setHeader("Content-Type", "text/html; charset=UTF-8"); response.getWriter().write(""); response.getWriter().flush(); response.getWriter().close();方法二 response.setContentType("text/html;charset=UTF-8");
方法一 response.setHeader("Content-Type", "text/html; charset=UTF-8"); response.getWriter().write(""); response.getWriter().flush(); response.getWriter().close(); 方法二 response.setContentType("text/html;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); response.setHeader("Cache-Control", "no-cache"); PrintWriter out = response.getWriter(); out.println(""); out.flush(); out.close(); out = null; return null; 小技巧: java后台调用js代码 response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); String call_back = ""; response.getWriter().write(call_back); response.getWriter().flush(); response.getWriter().close(); html前端调用函数(在同一个html中写两个script 后台调用不同的script函数 需要加上 parent.openStaticPopup)