req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
resp.setCharacterEncoding("utf-8");
PrintWriter writer = resp.getWriter();
writer.println("<html>");
writer.println("<body>");
writer.println("<h1>你好<h1>");
writer.println("</body>");
writer.println("</html>");
来源:CSDN
作者:黑-白-色
链接:https://blog.csdn.net/weixin_45207388/article/details/104017193