麻烦看一下!!!!!!

flying_bird 2001-07-25 04:24:58
怎么样在jsp页面中输出pdf或者doc等格式给客户端。。
使客户能自动打开相应的程序打开阅读??

拜托各位了!!!
...全文
47 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xskyssdt 2001-07-25
  • 打赏
  • 举报
回复
不会吧?我打印word,excel,pdf文档都是用这种方法
flying_bird 2001-07-25
  • 打赏
  • 举报
回复
可是不行啊!
输出的是文件的内容,不是用相应的程序打开的!
那个程序我机子上装了的!
xskyssdt 2001-07-25
  • 打赏
  • 举报
回复
BufferedOutputStream out1 = null;
res.setContentType("application/pdf");
try{
out1 = new BufferedOutputStream(res.getOutputStream());
byte[] buf =new byte[2048];
int num;
while((num=in.read(buf,0,buf.length)) != -1){
out1.write(buf,0,num);
}
}
catch(Exception e){
}

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧