首页 > 其他 > 详细

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

时间:2014-01-21 01:15:55      阅读:364      评论:0      收藏:0      [点我收藏+]
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方式接受参数乱码解决方法

原文:http://blog.csdn.net/zhanyan_x/article/details/18321013

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!