This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes 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 "Image from Database" Watch "Image from Database" New topic

Image from Database

Hari adya

Joined: Aug 21, 2009
Posts: 10
in a portal, the empployee's pic is stored under the /build/web/userpic directory

the name of the pic is stored in a MySQL database,
I use a result set to get the name of the pic, and i want to display the employee's image.
like ths

<img src="../../build/web/userpic/<%=rs.getString("picture")%>">
(two directories up)

but the image is not getting displayed

Please help!
David Newton

Joined: Sep 29, 2008
Posts: 12617

Is it in /build/web/..., or is it in ../../build/web...?
Hari adya

Joined: Aug 21, 2009
Posts: 10
I solved the problem
regarding your question. the JSP page is present in

pic in

i thought i have to go 2 levels up and then come back to userpic, but now i came to know USERPIC folder in build is a referred runtime i have to give http://localhost:8084/XXXXXXX/userpic/img.jpg but not http://localhost:8084/XXXXXXX/build/web/userpic/img.jpg

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Image from Database
It's not a secret anymore!