- 論壇徽章:
- 0
|
jsp瀏纜圖片的code,圖片顯示正常,但報這樣的錯:clientAbortException:java.net.SocketException:connection reset by peer:socket write error
代碼如下:(注:rs為取的數(shù)據(jù)集,tmp為圖片文件名)
try{
while(rs.next()){
response.setContentType("image/jpeg" ;
String tmp=rs.getString("Save_Path" ;
FileInputStream str=new FileInputStream(tmp);
ServletOutputStream sout=response.getOutputStream();
InputStream in=str;
byte b[]=new byte[0x7a120];
for(int i=in.read(b);i!=-1; )
{
sout.write(b);
in.read(b);
}
sout.flush();
sout.close();
rs.close();
}
}
catch(Exception e){System.out.println(e);} |
|