struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amir Hossein Sharifzadeh <a_sharifza...@yahoo.com>
Subject Displaying BLOB image in a jsp page through struts...
Date Sun, 07 Sep 2008 11:17:08 GMT
Dear J2ee members
I am trying to display an image in a jsp page which is stored as a blob in the oracle table.
I wrote a stored procedure to get all the images for a particular id.

and in the servlet(action), I wrote the following:

    code:


    ResultSet rsImg = verServ.getImages(EtaId,conn);
    while(rsImg.next())
    {
     VDTO vadto = new VDTO();
     Blob Imgs = rsImg.getBlob("IMG");
     byte ImgData[] = Imgs.getBytes(1,(int)Imgs.length());
     vadto.setImgData(ImgData);
     vadto.setImgs(rsImg.getBlob("IMG"));
     ImagesLst.add(vadto);
    }
    request.setAttribute("images",
 ImagesLst);



I am passing the Arraylist as a request Attribute to the jsp page, from where the Img tag
calls a servlet passing the byte[].

Although I use Struts Framework, I would use jsp/struts tags for displaying my image(s) in
jsp

Please guide me to write tags in jsp/struts for displaying my images.

-- Best
   Amir Hossein


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message