• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems in fetching photo from Database

 
Zaid Fattuhi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am storing some photos in MySQL database, and fetching them using a servlet, the problem is that I have list of photos in a JSP page, and whenever I referh the page the photos got mixed up and appear randomly, sometimes one of the photos appear instead of 3 photos, and sometimes 1 photo appear istead of 2 photos. I put the anti-caching script in the JSP list page, however still the same.

for example, the below jsp excerpt is correct HTML, however, it don't show the right photos :

<td><img src="/irtiadAlafaqAdmin/getSeriesSloganPhotoAction.do;jsessionid=325C3BD9FEBA53F47F4DAC66E9F12AAA?seriesID=1"></td>
<td><img src="/irtiadAlafaqAdmin/getSeriesSloganPhotoAction.do;jsessionid=325C3BD9FEBA53F47F4DAC66E9F12AAA?seriesID=2"></td>
<td><img src="/irtiadAlafaqAdmin/getSeriesSloganPhotoAction.do;jsessionid=325C3BD9FEBA53F47F4DAC66E9F12AAA?seriesID=3"></td>


the servlet is as below:

prep=myConnection.prepareStatement("SELECT sloganBinaryData,sloganContentType FROM series WHERE seriesID='"+form1.get("seriesID")+"' ");
results=prep.executeQuery();
if(results.next()){
OutputStream output=response.getOutputStream();
response.setContentType(results.getString("sloganContentType"));

response.setContentLength(results.getBytes("sloganBinaryData").length);
output.write(results.getBytes("sloganBinaryData"));
output.close();
..
.
...
return null;


Awaiting for your respionse,

cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!