response.getOutputStream().write();问题 response.getOutputStream().write(new String(content,0,字节长度); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 上面错了改为response.getOutputStream().write(content,0,字节长度); 试试看。 PrinterWriter pw = response.getOutputStream();然后用pw.write()来写,如果还不行把你的content里的东西转一下码,之后写进去 public void writeToHttpServletResponseWithDownloadFile(javax.servlet.http. HttpServletResponse response) throws java.io.IOException { response.setContentType(this.getContentType()); response.addHeader("Accept-Ranges", "bytes"); response.addHeader("Accept-Length", String.valueOf(this.content.length)); response.addHeader("Content-Disposition", "attachment; filename=\"" + this.name + "\"");// response.setContentType("text/html;charset=GBK"); System.out.println("content:"+new String(content,"GBK")+" content.length:"+content.length); response.getOutputStream().write(this.content,0,content.length); response.getOutputStream().flush(); response.getOutputStream().close(); }content是文件内容,是对的文件名是this.name,传过去是乱码 PrinterWriter pw=response.getOutputStream();这要报错的嘛 JSF_Facelets问题 ibatis如何同时查询多表数据显示在同一个网页上 怎样单独使用 Ext 的 combobox javaScript radio问题 在线等!!! jsp使用Bean调用dll的问题 关于jsp的session问题 J-UI框架使用struts2标签就报错 我刚刚做了两个网站,几经修改,终于与大家见面了!多多请教(散分) Struts中:<logic:present role="Admin">怎么用? jsp连接mysql数据库问题。 请教各位一个beanUtil中的copyProperties()的问题 请教一个关于“附件”的问题???急、急、急!!!!!
然后用pw.write()来写,
如果还不行把你的content里的东西转一下码,之后写进去
HttpServletResponse response) throws java.io.IOException
{
response.setContentType(this.getContentType());
response.addHeader("Accept-Ranges", "bytes");
response.addHeader("Accept-Length", String.valueOf(this.content.length));
response.addHeader("Content-Disposition",
"attachment; filename=\"" + this.name + "\"");
// response.setContentType("text/html;charset=GBK");
System.out.println("content:"+new String(content,"GBK")+" content.length:"+content.length);
response.getOutputStream().write(this.content,0,content.length);
response.getOutputStream().flush();
response.getOutputStream().close();
}
content是文件内容,是对的
文件名是this.name,传过去是乱码
这要报错的嘛