title: display multiple blob images in a single page
body: <p>Hi I am using servlets to read BLOB images form oracle database and display it in a html page</p>
  
  <p>My example code is </p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
  
          Connection conn = null;
          Statement stmt = null;
          ResultSet rs = null;
          String driver = "oracle.jdbc.driver.OracleDriver";
          final String url = "jdbc:oracle:thin:@//157.227.32.153:1521/DNADB5";
          final String username = "flex_user";
          final String password = "flex_user";
          int id=Integer.parseInt(request.getParameter("id"));
          String query = "SELECT img_id,MP_ID , icon FROM Account_images where MP_ID=" +id;
          ServletOutputStream out = response.getOutputStream();
          try {
              System.out.println("Getting connection");
               Class.forName(driver);
               conn = DriverManager.getConnection(url, username, password);
  
               stmt = conn.createStatement();
               rs = stmt.executeQuery(query);
               response.setContentType("text/html");
               if (rs.next()) {
                 InputStream in = rs.getBinaryStream("icon");
  
                 int bufferSize = 1024;
                 byte[] buffer = new byte[bufferSize];
                 int len=0;
                 while ((len=in.read(buffer)) != -1) {
                  // System.out.println("writing " + length + " bytes");
                   out.write(buffer, 0, len);
                 }
                 System.out.println("writed.");
                 in.close();
                 out.flush();
               }
  </code></pre>
  
  <p>With this code i am able to display a single image but i need to display all the images with the same MP_ID. 
  Could anyone help me??</p>
  
  <p>Thanks in advance..</p>