请教文件下载时的文件名乱码问题 好像有时候会有这种情况不是很清楚。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我是这么做的<%@ page import="java.io.*" %><%@ page language="java" contentType="text/html; charset=GBK" %><%try{ String path = request.getParameter("path"); String filename = path.substring(path.lastIndexOf("\\")+1); filename = new String(filename.getBytes("GBK"),"ISO8859_1"); response.setHeader("Content-disposition","attachment; filename="+filename); FileInputStream fis = new FileInputStream(path); OutputStream os = response.getOutputStream(); int byteRead; while((-1) != (byteRead = fis.read())){ os.write(byteRead); } os.close(); if (fis != null){fis.close();}}catch(Exception e){ out.print(e);} <select>如何显示表格? jsp对字符串操作 参加CNNIC调查中万元大奖回家过年 有没有反向分割字符串方法啊? 想把tomcat集成到iis,在IIS添加ISAPI筛选器isapi_redirect,一直没有箭头出现? 谁给我讲讲网络版校内通的实现原理和技术 新手,求大神帮忙解答Ajax在JSP页面查询号码归属地 sqlserver2000和tomcat4.1.24长时间连接出错 SSH2中使用birt java.lang.NoClassDefFoundError求大神帮忙 如何在resin或者tomcat下支持php和cgi(在线等待) 新闻系统中的连接字符串问题(急!!!)
<%@ page import="java.io.*" %>
<%@ page language="java" contentType="text/html; charset=GBK" %>
<%
try{
String path = request.getParameter("path");
String filename = path.substring(path.lastIndexOf("\\")+1);
filename = new String(filename.getBytes("GBK"),"ISO8859_1");
response.setHeader("Content-disposition","attachment; filename="+filename);
FileInputStream fis = new FileInputStream(path);
OutputStream os = response.getOutputStream();
int byteRead;
while((-1) != (byteRead = fis.read())){
os.write(byteRead);
}
os.close();
if (fis != null){fis.close();}
}catch(Exception e){
out.print(e);
}