方法很多,基本方法就是要把文件数据流搞到客户端了
解决方案 »
- Java 使用smtp协议发送邮件
- JScrollpane的问题
- 明明在*.java文件里有三个类,编译为什么就只生成两个对应的字节码文件,怪了!!高手请
- 如何在jtable的tableheader上面添加复选框
- socket接收服务器的消息,如何实现在10秒内如果服务器没回消息,就断掉socket连接,结束接收状态?
- 关于ServerSocket的问题
- **!有关JPanel的事件监听器问题!**
- 怎样获得鼠标位置的屏幕颜色?
- 我想显示这样的树结构,每个树节点都是CHECKBOX类型的,我该怎么实现?有没有源代码?
- [100分] 请教一个字符串操作
- jbuilder8光标位置的问题
- 兄弟们! 为什么我运行《Thinking In Java》中的Socket例子的代码会报错啊!!! 高分!
我的程序 如下:
报错说已经打开一个word窗口,不能关闭word,是什么原因?String Sql= "SELECT MACCOUNT FROM JHYH_GWFJB where MDOCID='"+mdocId+"'and MCONTENTID='"+contentId+"'";
//String Sql1="SELECT MCREATEID FROM JHYH_GWFJB where MDOCID='"+mdocId+"'and MCONTENTID='"+contentId+"'";
try
{
ResultSet rs = DBMgr.executeQuery(sqlCon, Sql);
System.out.println("CreatMisBlobSql="+Sql);
OutputStream outFile=response.getOutputStream();
response.setContentType("application/msword");
response.addHeader("content-type","application/msword");
//response.addHeader("Content-Disposition", "attachment; filename=\"" + "Temp."+FileType + "\"");
response.addHeader("Content-Disposition", "inline; filename=\"" + "Temp."+FileType + "\"");
if (rs.next())
{
InputStream inFile = rs.getBinaryStream(1);
int length=0;
int STREAM_SIZE = 1000000;
byte[] buffer = new byte[STREAM_SIZE];
while ((length = inFile.read(buffer)) != -1)
{
System.out.println("readed lenth = "+length);
outFile.write(buffer,0,length) ;
System.out.println("write over!!!!!!!!!!");
}
}
rs.close();
System.out.println("111111111");
outFile.close();
System.out.println("222222222222");
} catch(Exception e)
{
e.printStackTrace();
}
finally
{ sqlCon.close();}
System.out.println("3333333333333333333");%>
现在报错说: