protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //req.setCharacterEncoding("utf-8");只支持post req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=utf-8"); PrintWriter out=resp.getWriter(); out.println(new String(req.getParameter("id").getBytes("iso8859-1"),"gbk") ); out.flush(); out.close(); }