配置:tomcat6.0 myeclip8.5 mysql数据库  图片为byte[]类型

解决方案 »

  1.   

    http://robinsoncrusoe.javaeye.com/blog/798830
      

  2.   

    可是我用ssh模式做的啊   
      

  3.   

    这句话是就JSP页面的getImage.action?book.ISBN=<s:property value="#onebook.ISBN"/>
    什么意思啊 
      

  4.   

    4楼正解,自己到getImage.action里面去输出图片流
      

  5.   


    public void insertData(String filePath1, String tempStr1, String sql,String filename) {
    try {
    PreparedStatement pstmt = null;
    // String sql = "";
    File file = new File(filePath1); InputStream photoStream = new FileInputStream(file); pstmt = con.prepareStatement(sql);
                    pstmt.setString(2, filename);
                            // 文件名
    pstmt.setString(3, tempStrID);
                            // 要插入的列
    pstmt.setBinaryStream(1, photoStream, (int) file.length());
    //图片文件的流
                            pstmt.executeUpdate();
    System.out.println("写入文件");
    pstmt.close();
    // con.close();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    我有一个,是用SQl数据库写的。楼主参考一下吧