This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes How to show image from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to show image from database" Watch "How to show image from database" New topic
Author

How to show image from database

andrea casini
Greenhorn

Joined: Jul 27, 2010
Posts: 13
Hello to everyone.

I have succesfully upload an image to a database. Now comes the hardest part: display this image..
I load in the session a bean named "test" with attribute "image" (type byte[]) in wich the image is savad. Now I can't figure it out on how to display this image into the jsp.

I'd like to do something like this:



But obviously it does'nt work..:P

Anyone can help?

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Search the web for "image servlet". You can do the same thing with an action if you want, just return null instead of an action forward.
andrea casini
Greenhorn

Joined: Jul 27, 2010
Posts: 13
David Newton wrote:Search the web for "image servlet". You can do the same thing with an action if you want, just return null instead of an action forward.


LOL.. I found also my topic..:D
Ok.. So I create this action:


And in the jsp I put this:


It work. But I want to display this image without typing on a link and I'd like to render the image (minimize it to a specific size).
I tried returning null and use <html:image src="/viewImage.do"/> but nothing. Why??
 
Consider Paul's rocket mass heater.
 
subject: How to show image from database
 
Similar Threads
How to display a dynamic image along with other fields
display image and text both on jsp page
how to retrieve image in jsp page from a seperate folder.
thumbnail in jsp
Displaying an image in jsp