File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to know the absolute directory path of WebContent folder?

 
giang nguyen
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using WAS 5.0 and need to upload image to a folder under WebContent. I use strut upload form and now need to write uploaded image . How can I know from the context of a servlet the absolute directory path of my web application so that I can save the image file to the right destination? I have to save the images to webcontent because I will need to show it again in my webpage.
Thanks
 
Deepak Ramachandran Nair
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

If you are using servlets then use
ServletContext.getRealPath("/")

If you are usign JSP use
application.getRealPath("/") to obtain the path of the webcontent
folder

Regards
Deepak
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic