Forums Register Login

Displaying an image from byte[] into JSP

+Pie Number of slices to send: Send

Hi, I am using spring 3. I need your help in a isue.
I am trying to display an image which in MS-SQL db with datatype image. In the controller, I am retrieving as byteArray, but now question is how to display it.

Need your kind suggestions.

+Pie Number of slices to send: Send
Here is more explannation:

image retrieval from sql server using java
our clients have a sql server database in which one of the table column of image data type holds a image.I am not able to retrieve the image.I have tried retrieving only certain no of bytes, but not able to see the image.If any body knows about this issue please reply thread
+Pie Number of slices to send: Send
make sure that it is fully uploaded image in the database not partially.
As you said you are able to get few byte, make sure that complete image is in database.
+Pie Number of slices to send: Send
NO, that image is uploaded fully because, I can see that image in VB application.it's migration project. hence, I am sure image is uploaded perfectly.
+Pie Number of slices to send: Send
 

but not able to see the image.



EXACTLY how are you trying to display the image? Please show the code.

You do realize that a JSP is for characters and not binary data right?

Bill
+Pie Number of slices to send: Send
how you are retrieving the image from the database
can you post your code.
my following code is doing perfectly
+Pie Number of slices to send: Send
Stop. Think.

A JSP is a template for creating an HTML page. So how does one display an image in an HTML page? Do you put the image data in the HTML page? Do you?

Stop. Think.
+Pie Number of slices to send: Send
I also had the same problem but resolved by some help from google. Here is what I did: I created a servlet which will fetch the image from mysql database as below:



Then in my JSP page I called


This will display the image in a JSP page. Hope you find this as useful.
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 20440 times.
Similar Threads
DISPLAY an IMAGE
Sending image from 1 computer to another.
Question about layout
Displaying thumb nail image
How to display one image per day from an array?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:04:26.