This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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


Win a copy of Elasticsearch in Action this week in the Big Data forum!
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: 9327
    
  19

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?