permaculture playing cards*
The moose likes Struts and the fly likes Images in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Images in Struts" Watch "Images in Struts" New topic
Author

Images in Struts

Raza Khan
Greenhorn

Joined: Nov 19, 2008
Posts: 15
Hi All,
I have images stored in the database. What would be the proper way to fetch these images. I have used <c ut tag in JSP but unable to get images.
How can i do this?? in struts which option is better--- 1) displaying images from database or 2) creating new image folder to keep image files

Thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Unless there is a compelling reason to store images in the database, I would use the file system and standard HTML IMG tags.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd agree with Joe, but if that isn't possible, you can stream images to the response through an action or a servlet and access them via an IMG tag.
Raza Khan
Greenhorn

Joined: Nov 19, 2008
Posts: 15
Thanks Joe and David... but is there any <c: tag to display images like <c ut .. etc...

thnks again

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, there's the <img...> tag. If you're streaming the image from the DB through an action or servlet you have the "src" attribute be the appropriate servlet/action URL.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Images in Struts
 
Similar Threads
printing images in jsp
Display Images using Struts
Putting an image on JSP
how to convert byte array to images
insert view, images from mysql database using jsp program