Response.setContentType("text/html;charset=GBK");
Response.getWriter().print("<script language=javascript>alert('未登陆或超时,请重新登陆! 管理员:[email protected]');window.location='"+loginPage+"';</script>");

解决方案 »

  1.   

    在得到out对象前加上:outResponse.setContentType("text/html;charset=GBK"); 
      

  2.   

    不可能,我copy你的代码,然后加上Response.setContentType("text/html;charset=GBK");这句行
      

  3.   

      public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html;charset=GBK"); // 要放在最开始的地方才行
        PrintWriter out = response.getWriter();
        out.println("中文");
      

  4.   

    竹子24小时在线回复.CSDN的人肉解答机.....膜拜
      

  5.   

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("text/html;charset=GBK"); // 要放在最开始的
    request.setContentType("text/html;charset=GBK"); // 要放在最开始的
    //也可加个Filter过滤
      

  6.   

    string sex = "中文";
    sex = new String(Gender.getBytes("ISO8859-1"));
    out.println(sex);不知道你要的是不是这个。
      

  7.   

    楼主这题是没有设定编码造成的。
    设定
    response.setContentType("text/html;charset=GBK"); 
    response.setCharacterEncoding("GBK");
    我碰到的编码问题很奇怪。
    http://topic.csdn.net/u/20080109/15/0ba3ea83-e21b-4dbd-99c5-86341687559f.html
    有高手过来帮我看看。