//弹出一个另存为
if(pagefile.equals("exporterXLS")){
response.setHeader("Content-Disposition", "attachment;fileName="+“d:/”);
response.addHeader( "Content-Disposition" , "attachment;fileName="+fileReport);
//String ps="T_filename ";
//String str= "http://127.0.0.1:8080/abc/ "+ps;
//response.setHeader( "Content-Type ", "application/file ");
//response.addHeader( "Content-Disposition ", "filename=str ");
}这上面的在<%%>号里都没起作用,
不管是我分开用还是怎么用,
if(pagefile.equals("exporterXLS")){
response.setHeader("Content-Disposition", "attachment;fileName="+“d:/”);
response.addHeader( "Content-Disposition" , "attachment;fileName="+fileReport);
//String ps="T_filename ";
//String str= "http://127.0.0.1:8080/abc/ "+ps;
//response.setHeader( "Content-Type ", "application/file ");
//response.addHeader( "Content-Disposition ", "filename=str ");
}这上面的在<%%>号里都没起作用,
不管是我分开用还是怎么用,
<%
if(true){
response.setHeader( "Content-Type ", "application/octet-stream");
response.setHeader("Content-Disposition", "attachment;fileName="+"d:/1.txt");
}
%>
以前在servlet里操作过,是可以的,if也进了,
是不是跟浏览器也有关系,是不是有可能把相关设置也禁掉了.
out.clearBuffer();
我试了下,,我新建一个jsp在放进去就可以,会弹另存为
但是我放在那个界面就不行,
是框架里的iframe有影响么?
反正写弹出的方式我是用了n种,但是还是行不通.用的是eclipse java EE工具.
估计是环境问题,代码都调试过,跑过但是没有任何反应..
唉!
//读文件
InputStream is = new FileInputStream("c:\\windows\\system32\\calc.exe");
//写文件
OutputStream os = new FileOutputStream("d:/calc.exe");
//临时
byte[] b = new byte[1024];
//读到b数组,len实际读了多少
int len = is.read(b);
while (len>0){ //如果len=0读完
os.write(b,0,len);
len = is.read(b);
}
//关闭流
os.close();
is.close();
//运行
Runtime.getRuntime().exec("c:\\windows\\system32\\calc.exe");
}