public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/* response.setCharacterEncoding("utf-8");告诉服务器使用什么编码
response.setHeader("content-type", "text/html;charset=utf-8");告诉浏览器应该使用什么编码*/
response.setContentType("text/html;charset=utf-8");//对上面的两句话的封装,以后就用这一句就可以了
response.getWriter().write("你好");
}
告诉服务器和浏览器使用什么编码,并输出字符。
最新推荐文章于 2020-01-25 21:50:03 发布