在页面点击一个下载链接,进入以下下载页面
<%
try{
DownLoadUtil su = new DownLoadUtil();
su.initialize(pageContext);
su.setContentDisposition(null);
String path = System.getProperty("user.dir").replace("//bin", "").concat("/webapps").concat(request.getContextPath()).concat("/soft/MingoeSetupCn.exe");
File f = new File(path);
if (!f.exists()) {
%>
<c:redirect url="download_error.html"></c:redirect>
<%
} else {
su.downloadFile("/soft/MingoeSetupCn.exe");
String file = System.getProperty("user.dir").replace("//bin", "").concat("/webapps").concat(request.getContextPath()).concat("/admin/common/download/DownloadNum_ZH.txt");
DownloadCountUtils.write(file);
}
%>
<%
out.clear();
out=pageContext.pushBody();
} catch (IOException e) {
//e.printStackTrace();
} catch (Exception e) {
//e.printStackTrace();
}
%>