File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to set a image path in my bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to set a image path in my bean?" Watch "How to set a image path in my bean?" New topic

How to set a image path in my bean?

rakshini nithya
Ranch Hand

Joined: Jun 15, 2006
Posts: 39
Actually am trying to user's photo
The need is i have to fetch the user's image file and store it in a common folder and how can i retrieve that image from that path
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm not totally sure I understand the question, but it sounds like you have image files that are on the server's file system, but not in the context path of your web application and you want to display images from those files. Is that right?

You would do this by using the classes to read the file and then write the output to the HttpServletResponse objet's Output Stream.

Fortunately for you, one of the examples in the struts-examples.war file (comes with the download) does exactly this. Unpack the war file and take a look at org.apache.struts.webapp.exercise.ImageAction. You will see how it's done.

Consultant, Sima Solutions
I agree. Here's the link:
subject: How to set a image path in my bean?
It's not a secret anymore!