ssh框架commons-io包的下载对话框如何弹出 ssh框架commons-io包的下载对话框如何弹出,就是点击下载弹出要下载东西的保存路劲。我会JFrame的但是太丑了java 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你想多了,那个下载对话框是浏览器自己的组件。你拿Jframe写的东西能在客户的浏览器运行?你给它做成Applet了? 给你一个,我在项目中用的,OutputStream out=response.getOutputStream(); response.setContentType(document.getContentType());// System.out.println(document.getFileName());// response.setCharacterEncoding("utf-8"); String downName=new String(document.getFileName().getBytes("gbk"),"iso8859-1"); response.setHeader("Content-Disposition", "attachment;fileName="+downName); InputStream input=document.getContent().getBinaryStream();// int a;// while((a=input.read())!=-1){// out.write(a);// } IOUtils.copy(input,out); out.flush(); out.close(); input.close(); eclipse配置resin运行的问题 ibatis框架 jsp打印中如何设置默认页边距 正则表达式 怎么在下个.sp页面获取上个JSP的值 Servlet action is not available tomcat5.0 数据源配置问题 菜虫提问:怎么用jsp? 在同一页里javascript的变量值怎么传给jsp代码? springboot小程序一直404 【新人】servlet中关于数据库连接?! EATJ server免费账户 tomcat重启问题
response.setContentType(document.getContentType());
// System.out.println(document.getFileName());
// response.setCharacterEncoding("utf-8");
String downName=new String(document.getFileName().getBytes("gbk"),"iso8859-1");
response.setHeader("Content-Disposition", "attachment;fileName="+downName);
InputStream input=document.getContent().getBinaryStream();
// int a;
// while((a=input.read())!=-1){
// out.write(a);
// }
IOUtils.copy(input,out);
out.flush();
out.close();
input.close();