jsp制作批量下载
一次点击同时下载多个文件,希望具体一点!!!
------解决方案--------------------su.downloadFile(request.getParameter( "TEST "));
------解决方案-------------------- <input type= "checkbox " name= "range " value= "xxx.zip " />
<input type= "checkbox " name= "range " value= "xxx.jpg " />
<input type= "checkbox " name= "range " value= "lll.zip " />
<input type= "submit " name= "submit " onclick= "down() ">
<script language= "javascript ">
funciton down(){
var v=document.getElementsByName( "range ");
for(var i=0; i <v.length; i++)
{
if(v[i].checked)
{
window.open( "downfile.jsp?fileName= "+v[i].value);
}
}
}
</script>
downfile.jsp:
<%
SmartUpload su = new SmartUpload();
// 初始化jspSmartUpload
su.initialize(pageContext);
// 设定contentDisposition为null以禁止浏览器自动打开文件,
su.setContentDisposition(null);
String filename=su.getRequest().getParameterValues( "filename ");
su.downloadFile( "\downfile\ "+filename);
}
// 下载文件
%>
这样就是一个很另类的批量下载 哈哈哈哈~~ 不过传递的参数filename里面的文件名字含有中文,就得先对它进行转码,然后再传递~~