ResultSet rs = userData.queryImgUnderWrite("040311000");
      int i=0;
       if(rs.next()){
       InputStream  in  =  rs.getBinaryStream("imgUnderWrite");    这样样写就能显示,但抱org.apache.jasper.JasperException: getOutputStream() has already been called for this response1.是不是不能直接返回 InputStream  ?
2.为什么会抱getOutputStream() has already been called for this response

解决方案 »

  1.   

    给你一段代码,参考一下了:
    String path = pathStr;
             String contentDisposition = "" ;
    String picExt = picExt
    String contentType = "image/"+picExt;  response.setContentType(contentType);
      response.setHeader("Content-Disposition", contentDisposition);

    CPicTreeCommon picCom = new CPicTreeCommon();
             File file = new File(path);
             FileInputStream in = new FileInputStream(file);
    int length = (int)file.length();
    if(length != 0)  {
      byte[] buf = new byte[1024];
        ServletOutputStream op = response.getOutputStream();
       while ((in != null) && ((length = in.read(buf)) != -1))
       op.write(buf,0, length);
        in.close();
      op.flush();
       op.close();
       }
      

  2.   

    你第一种方法报错可能跟你的InputStream  in  =  receiveFileFlow.judgeIsViewLeader("11111");    这个方法有关,你单步调试看看。
    还有你response.getOutputStream().write(b,0,len);    
    要执行flush方法的。