用的是这种方法:
response.setContentType("application/msexcel");
response.setHeader("Content-disposition","inline; filename=test.xls");
难道这种方法有什么BUG吗??

解决方案 »

  1.   

    String filename = "测试.xls";
    response.setContentType("application/msexcel");
    response.setHeader("Content-disposition","inline; filename=" + new String(filename.getBytes("ISO-8859-1")));
      

  2.   

    楼上的,你说的方法没用啊!
    急啊!继续等待解决办法。
    顺便说一下,我的JSP中用的是这个:
    <%@ page language="java" contentType="text/html;charset=GBK" %>
      

  3.   

    你是指 Excel 的乱码吧.. 如果是这样, 帖出生成的代码来..
      

  4.   

    不好意思, 刚才发错了..现在纠正
    String filename = "测试.xls";
    response.setContentType("application/msexcel");
    response.setHeader("Content-disposition","inline; filename=" + new String(filename.getBytes(), "ISO-8859-1"));
      

  5.   

    HashMap map_bake = new HashMap();
              String specialtimes_bak = "";
              String specialfees_bak = "";
    //          String TMP1 = "Date";
    //          String TMP2 = "Total";
    //          String TMP3 = "Times";
    //          String TMP4 = "Fees(yuan)";
              String TMP1 = "日期";
              String TMP2 = "总量";
              String TMP3 = "次数";
              String TMP4 = "金额(元)";
              //String filename = "导出.xls";
              ArrayList al=(ArrayList)session.getAttribute("ResultSession");
              response.setContentType("application/msexcel");
              //response.setHeader("Content-disposition","inline; filename="+ new String(filename.getBytes(), "ISO-8859-1"));
              response.setHeader("Content-disposition","inline; filename=test.xls");
              out.clear();
              out.println("<table border='1'>");
              if("0".equals(spindex)){
                out.println("<tr><td rowspan=\"2\">SP<br></td>");
              }
              if(!checkflag.equals("2")){
                out.println("<td rowspan=\"2\">"+TMP1+"</td>");
              }
              out.println("<td colspan=\"2\">"+TMP2+"</td>");
              for(int m=0;m<arryopmode.size();m++){
                tempmap = (HashMap)arryopmode.get(m);
                opermodenum = (String)tempmap.get("opermode");
                out.println("<td colspan=\"2\">"+QueryUtil.transOperMode(Integer.parseInt(opermodenum))+"</td>");
              }
              out.println("</tr><tr>");
                    for(int m=0;m<=arryopmode.size();m++){
                      out.println("<td>"+TMP3+"</td><td>"+TMP4+"</td>");
                    }
              out.println("</tr>");
              for (int i = 0; i <al.size(); i++) {
                map_bake = (HashMap)al.get(i);
                out.println("<tr>");
                if("0".equals(spindex)){
                  out.println("<td>"+QueryUtil.isNull(map_bake.get("spname"),"0")+"</td>");
                }
                if(!checkflag.equals("2")){
                  out.println("<td>"+QueryUtil.isNull(map_bake.get("statdate"),"0")+"</td>");
                }
                out.println("<td>"+QueryUtil.isNull(map_bake.get("sumtimes"),"0")+"</td>");
                out.println("<td>"+CrbtUtil.displayFee(QueryUtil.isNull(map_bake.get("sumfee"),"0"))+"</td>");
                for(int k=0;k<arryopmode.size();k++){
                  tempmap = (HashMap)arryopmode.get(k);
                  opermodenum = (String)tempmap.get("opermode");
                  specialtimes_bak = opermodenum+"_statcode";
                  specialfees_bak = opermodenum+"_ringfee";
                  out.println("<td>"+QueryUtil.isNull(map_bake.get(specialtimes_bak),"0")+"</td>");
                  out.println("<td>"+CrbtUtil.displayFee(QueryUtil.isNull(map_bake.get(specialfees_bak),"0"))+"</td>");
                }
                out.println("</tr>");
              }
              out.println("</table>");
              al.clear();
              return;
      

  6.   

    SP Name &Egrave;&Otilde;&AElig;&Uacute; ×&Uuml;&Aacute;&iquest; &Icirc;&acute;&Ouml;&ordf; WEB IVR SP
    &acute;&Icirc;&Ecirc;&#305; &frac12;&#287;&para;&icirc;(&Ocirc;&ordf;) &acute;&Icirc;&Ecirc;&#305; &frac12;&#287;&para;&icirc;(&Ocirc;&ordf;) &acute;&Icirc;&Ecirc;&#305; &frac12;&#287;&para;&icirc;(&Ocirc;&ordf;) &acute;&Icirc;&Ecirc;&#305; &frac12;&#287;&para;&icirc;(&Ocirc;&ordf;) &acute;&Icirc;&Ecirc;&#305; &frac12;&#287;&para;&icirc;(&Ocirc;&ordf;)
    &sup3;¤&Eacute;&sup3;&Atilde;÷&Oacute;&icirc; 2006.11 2 4 0 0 0 0 2 4 0 0
    &Aacute;&ordf;&para;&macr;&Auml;&Eacute;&Icirc;&not; 2006.11 2 4 0 0 2 4 0 0 0 0
    ±±&frac34;&copy;&#286;&Ccedil;&cedil;&ntilde; 2006.11 2 4 0 0 2 4 0 0 0 0
    &frac34;&copy;&Igrave;&copy; 2006.11 1 1 0 0 0 0 0 0 1 1
    &ordm;&#351;&Auml;&Iuml;&Ograve;&AElig;&para;&macr; 2006.11 1 4 0 0 1 4 0 0 0 0