<%
String filePath = "/"+request.getParameter("path");
String fileName = com.nstc.xxx.util.CqUtil.toGBK(request.getParameter("name"));
if(fileName!=null&&filePath!=null){
response.setContentType("application/x-download");
response.addHeader("Content-Disposition","attachment;filename=" + java.net.URLEncoder.encode(fileName,"UTF-8"));
try{
RequestDispatcher dis = application.getRequestDispatcher(filePath);
dis.forward(request,response);
response.flushBuffer();
}catch(Throwable e){
e.printStackTrace();
}finally{
}
}
%>
String filePath = "/"+request.getParameter("path");
String fileName = com.nstc.xxx.util.CqUtil.toGBK(request.getParameter("name"));
if(fileName!=null&&filePath!=null){
response.setContentType("application/x-download");
response.addHeader("Content-Disposition","attachment;filename=" + java.net.URLEncoder.encode(fileName,"UTF-8"));
try{
RequestDispatcher dis = application.getRequestDispatcher(filePath);
dis.forward(request,response);
response.flushBuffer();
}catch(Throwable e){
e.printStackTrace();
}finally{
}
}
%>
<a herf='X.jsp?fileName=a.doc&filePath=x/a.doc'>呵呵,这样迅雷也可以下载了,而且页面并不会跳转 </a>

118

被折叠的 条评论
为什么被折叠?



