Servlet通过get方式接受参数乱码解决方法

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();  
      
    }

Servlet通过get方式接受参数乱码解决方法

上一篇:hdu 1114 Piggy-Bank 完全背包


下一篇:UVALive - 4328 Priest John's Busiest Day