有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java我想从我的表(index\u img)中检索图像到我的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) 个答案