<%@ page language="java" pageEncoding="utf-8"%><%@ page import="java.io.*" %><% BufferedInputStream bis = null; BufferedOutputStream bos = null; try{ String filename="InstallClient.zip"; response.setContentType("application/x-msdownload"); response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\""); bis =new java.io.BufferedInputStream(new java.io.FileInputStream(config.getServletContext().getRealPath("/" + filename))); bos=new java.io.BufferedOutputStream(response.getOutputStream()); byte[] buff = new byte[2048]; int bytesRead; while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff,0,bytesRead); } } catch(Exception e){ e.printStackTrace(); } finally { if (bos != null) { bos.close(); } if (bis != null) { bis.close(); } out.clear(); out = pageContext.pushBody(); } %>
相关资源:jsp登陆界面源代码