www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need to display multiple images from database on a webpage.

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    5

    Thumbs down Need to display multiple images from database on a webpage.

    hi,

    I am able to display a single image from the database on a webpage using the

    following code:

    rs1 = st1.executeQuery("select image from pictures where id='5'");
    if(rs1.next()){
    int len = imgLen.length();
    byte [] rb = new byte[len];
    InputStream readImg = rs1.getBinaryStream(1);
    int index=readImg.read(rb, 0, len);
    System.out.println("index"+index);
    st1.close();
    response.reset();
    response.setContentType("image/jpg");
    response.getOutputStream().write(rb,0,len);
    response.getOutputStream().flush();


    Can any one help me to get the code to display more than one image on a *.jsp

    file. I tried putting the while loop, but it is'nt doing the job.

    Thanks.

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    take a look at the comments i made in this topic: http://www.webdeveloper.com/forum/sh...ighlight=image

    basically, keep your code, but call it repeatedly from a second servlet/jsp
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    May 2009
    Posts
    5

    Smile issue solved

    thanks chazzy. now i am able to display multiple images in a single webpage using:

    <img src="/imagepractise/DI?imageno=103" >

    :-)

  4. #4
    Join Date
    May 2012
    Posts
    1

    Post Multiple Image

    I need ur help in displaying multiple images in jsp pages.....
    Venkatesh.........

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles