File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 2  display image from Database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2  display image from Database? " Watch "Struts 2  display image from Database? " New topic
Author

Struts 2 display image from Database?

Aaron Raja
Ranch Hand

Joined: Jun 07, 2007
Posts: 206
is there a way to display image from Database to JSP directly without placing into any folder.
I can save and retrieve image from database and the place into some folder then display in jsp but I want to display directly from database to jsp.
Any clue ?


Thanks, AR
SCWCD 5, SCJP 1.4, OCA (PL/SQL)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

If you want to do this with Struts, then you can use the stream result of Struts 2. You'll have to create an action which will retrieve the image from the database and send it as a stream in the response. In your JSP you'll put the url of that action in the src attribute of img tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Aaron Raja
Ranch Hand

Joined: Jun 07, 2007
Posts: 206
any examples or tutorial on that please?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 display image from Database?