我想从我的表(index_img)中检索图像到我的jsp页面

时间:2017-04-04 13:59:52

标签: java html mysql sql jsp

  **How can I retrieve jpg image from my sql database..?
  I want to retrieve image inside the image tag.
  **


   Index.jsp  

      <!DOCTYPE html>
        <html lang="en">
         <head>
         </head>
          <body >
       <%          
                  Class.forName("com.mysql.jdbc.Driver");
                  Connection con = 
DriverManager.getConnection("jdbc:mysql://localhost:3306/portfolio","root","root");
                   Statement st3= con.createStatement();
                  ResultSet rs3=st3.executeQuery("select * from index_img");
   %>          


            <section class="no-padding" id="portfolio">
                    <div class="container-fluid">
                    <div class="row no-gutter popup-gallery">

                      <%  
              while(rs3.next())  
                    {  %>

                        <div class="col-lg-4 col-sm-6">
                            <a href="img/portfolio/thumbnails/wildlife/wl1.jpg" class="portfolio-box">




         <img src=" #" class="img-responsive" alt="">
                                <div class="portfolio-box-caption">
                                    <div class="portfolio-box-caption-content">
                                       <div class="project-category text-faded">
                                            <%=rs3.getString(2) %>
                                        </div>
                                        <div class="project-name">
                                           <%=rs3.getString(3) %>
                                        </div>
                                    </div>
                                </div>
                            </a>
                       </div>

                         <%}%>

                    </div>
                    </div>   

            </section>
</body>

        </html>

**我使用此表将图像存储在sql数据库中:   该表存储有关图像的ID,类别和描述。并且  存储图像位置。    我已经检索了类别和说明列...但我不知道如何从列图像中检索jpg图像**

        Index_img table

            Create Table index_img 
            ( 
               id int primary key,
               category  varchar(100) ,
               description  varchar(500) ,``
               image  blob
            ) ;

0 个答案:

没有答案