• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

retreiving images from the database and dispaly them on HTML file

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I've retreived stored as Blob from Oracle database, and get it as binary stream and write it into a file as follows
a1=res.getBlob("item_pic");
long len = a1.length();
int len2=(int)len;
InputStream input=a1.getBinaryStream();
data=new byte[len2];
int byte_read=input.read(data);

String p="C:\\tomcat\\webapps\\test\\jsp\\";
File temp=new File(p,"temp.jpg");
fos=new FileOutputStream(temp);
fos.write(data);
fos.close();
the image is stored in a .jpg file an i'm able to open it and view it with no problems,BUT, when i try to put this image in HTML file using
<img src="temp.jpg" > , i does not work!!!
the HTML file and the image are in the same folder, there is no corruption in the image , i'm able to open it and view it
can any body help me plz, this is driving me nuts!!!1

Regards.
Maher Dabbas
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the image is getting to the directory you want it to be in. Then instead of causing yourself the headache of changing and running the jsp, try just a simple HTML file and try to fix it from there first. It might just be a simple path or tag problem. When it's fixed, jost port your changes to the jsp.
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic