Bookmark Topic Watch Topic
  • New Topic

hi  RSS feed

 
zita lakshmi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi sir, i have set the image in database.while getting that image in jsp it is showing the text as like this [com.mysql.jdbc.Blob@694f12, com.mysql.jdbc.Blob@345b43, com.mysql.jdbc.Blob@153b2cb]
[com.mysql.jdbc.Blob@694f12, com.mysql.jdbc.Blob@345b43, com.mysql.jdbc.Blob@153b2cb]
[com.mysql.jdbc.Blob@694f12, com.mysql.jdbc.Blob@345b43, com.mysql.jdbc.Blob@153b2cb]. so how could i solve this , please send solution for this problem'

 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sir, please take a look at this topic, it's the same problem.

You don't write the Blob object to the client, because this way it's toString() method will be called, which does not return the bytes of the image. And you don't write the bytes of the image in the same stream that contains the HTML code either (it's possible to embed the image's data in HTML, but not every browser supports this). You create a separate servlet/controller instead that outputs just the requested image's data, see the other topic!

Next time please UseAMeaningfulSubjectLine!
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
1- This is not a spring question
2- You have to get this blob as a byte array, and send it to the user with the response having a header saying that this is of a mime type image, for example , then you write the byte array to the OutputStream of the response. I believe that you'll need have a separate controller (separate URL to be precise) to do this for each image
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!