jsp文件下载的奇怪问题,请大家帮忙。 有没有把 Content Type 设置为 application/x-download设置 content type 的那个方法名我记不得了,你查查文档,应该好找的。查 HttpResponse 里的吧。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把 Content Type 设置为 application/x-download不行啊文件被直接打开了请问还有什么方法吗谢谢 把 Content Type 设置为 application/x-download同时还要设置下面这个httpServletResponse.setHeader("Content-disposition","attachment; filename=测试.txt");---------response.setContentType("application/x-download");//或者//response.setContentType("application/octet-stream");String filename = response.encodeUrl("文件名.txt"); // 不知道这句话有没有必要,试试吧。response.setHeader("Content-Disposition", "attachment; filename=" + filename); String filename = response.encodeUrl("文件名.txt"); 这句话要改一下String filename = java.net.URLEncoder.encode("文件名.txt", "UTF-8"); to:zoutaosss (虾米)我也遇到了同样的问题,不知道你解决了没有,我们能否交流一下[email protected] 求助,SAML,XACML访问控制如何实现,求高手指点!! 关于页面挑转的问题: 高手请进,一个指纹识别系统的疑问!~!~~ 多重选择执行的问题,求思路 useBean获得参数问题!!?? jdbc连接sql2000的问题 如何使HTML页面中表格的行标题固定,就像EXCEL中冻结窗格功能一样?(问题一解决马上给分) 求救用jdbc连接sqlserver数据库问题! 《离散数学及其应用》和《具体数学》应该先看哪个? wervice 访问出现no SOAPAction header??? jsp连接 mysql 的问题 又是一个中文问题,帮忙看看,在线等
文件被直接打开了
请问还有什么方法吗
谢谢
同时还要设置下面这个
httpServletResponse.setHeader("Content-disposition","attachment; filename=测试.txt");---------
response.setContentType("application/x-download");
//或者
//response.setContentType("application/octet-stream");
String filename = response.encodeUrl("文件名.txt"); // 不知道这句话有没有必要,试试吧。
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
这句话要改一下
String filename = java.net.URLEncoder.encode("文件名.txt", "UTF-8");
我也遇到了同样的问题,不知道你解决了没有,我们能否交流一下
[email protected]