xsp(半个程序员) ,那应该怎样做,我没有做过,谢谢,请指教

解决方案 »

  1.   

    我做过,就是先用servlet导出excel在服务器端
    在jsp文件中:
          File f = new File("c:\\excelfile\\outfilename.xls");
            FileInputStream fin = new FileInputStream(f);
            response.setContentType("application/vnd.ms-excel;charset=gb2312");
            response.setHeader("Content-Disposition", "attachment; filename=savefile.xls");
            OutputStream output = response.getOutputStream();
            byte[] buf = new byte[1024];
            int r = 0;
            while((r = fin.read(buf, 0, buf.length))!= -1) {
                 output.write(buf, 0, r);
            }
            fin.close();
            output.close();祝你成功!