response.setContentType("application/vnd.ms-excel; charset=GBK"); try
{
File ff = new File(ÄãµÄexcelÎļþ);
response.setHeader("Content-Disposition", "attachment; filename=ÏúºÅ´¦Àí½á¹û.xls"); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(ff));
byte[] buf = new byte[1024];
ServletOutputStream out = response.getOutputStream();
for (int readed = bis.read(buf); readed >= 0; readed = bis.read(buf))
out.write(buf, 0, readed); bis.close();
out.flush();
out.close();
response.flushBuffer();
}
catch (Exception e)
{
log.debug("ÏÂÔØÎļþʱ³ö´í" + e.getMessage());
return null;
}
{
File ff = new File(ÄãµÄexcelÎļþ);
response.setHeader("Content-Disposition", "attachment; filename=ÏúºÅ´¦Àí½á¹û.xls"); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(ff));
byte[] buf = new byte[1024];
ServletOutputStream out = response.getOutputStream();
for (int readed = bis.read(buf); readed >= 0; readed = bis.read(buf))
out.write(buf, 0, readed); bis.close();
out.flush();
out.close();
response.flushBuffer();
}
catch (Exception e)
{
log.debug("ÏÂÔØÎļþʱ³ö´í" + e.getMessage());
return null;
}
{
File ff = new File(ÄãµÄexcelÎļþ);
response.setHeader("Content-Disposition", "attachment; filename=ÏúºÅ´¦Àí½á¹û.xls"); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(ff));
byte[] buf = new byte[1024];
ServletOutputStream out = response.getOutputStream();
for (int readed = bis.read(buf); readed >= 0; readed = bis.read(buf))
out.write(buf, 0, readed); bis.close();
out.flush();
out.close();
response.flushBuffer();
}
catch (Exception e)
{
log.debug("down file is error" + e.getMessage());
return null;
}
response.setHeader("Content-Disposition", "attachment; filename=ϺŴ¦Àí½á¹û.xls");
那些:(ÄãµÄexcelÎļþ)和=ϺŴ¦Àí½á¹û.xls");是干什么的?
是模拟嵌入还是真实嵌入啊?
response.setHeader("Content-Disposition", "attachment; filename=ϺŴ¦Àí½á¹û.xls");
那些:(ÄãµÄexcelÎļþ)和=ϺŴ¦Àí½á¹û.xls");是干什么的?
这些应当是要传文件的参数。