关于servlet中文输出的解决方案

来源:互联网 发布:vb picture 图形放大 编辑:程序博客网 时间:2024/06/08 13:07
  1. public void doGet(HttpServletRequest request, HttpServletResponse response)  
  2.         throws ServletException, IOException {  
  3.       
  4.     response.setContentType("text/html;charset=gb2312");////在PrintWriter前面有效果  
  5.     PrintWriter out = response.getWriter();  
  6.     request.setCharacterEncoding("utf-8");  
  7.    // response.setContentType("text/html;charset=gb2312");////在PrintWriter后面无效果  
  8.       
  9.      userId1 = request.getParameter("userId1");// ///需要2个参数  
  10.     userId2 = request.getParameter("userId2"); 

原创粉丝点击