linux是没有后缀可言的,你当成普通文件写入输出流不行么,非得用mine-type

解决方案 »

  1.   

    看看你的 win 和 Linux 是否都支持 Shift_JIS
      

  2.   


    还有一个方法是下载XLS的,没有问题,ShiftJIS是支持的。就是不能下载XLSXString fname = excelEntity.getFileName();
    String postfix = "xls";
    response.reset();
    response.setContentType("application/octet-stream;charset=Shift_JIS");
    response.setHeader("Content-Disposition", "attachment;filename="+ new String(fname.getBytes("UTF-8"), "ISO-8859-1")+"."+postfix);
    bos = new BufferedOutputStream(response.getOutputStream());
    HSSFWorkbook wb = this.getInventryHSSFWorkbook(request, excelEntity,list);
    wb.write(bos);
    实际上这两个方法没有区别,就是setContentType设置有点区别。