Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set a image path in my bean?

 
rakshini nithya
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 java.io 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic