aspose file tools*
The moose likes Websphere and the fly likes How to know the absolute directory path of WebContent folder? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "How to know the absolute directory path of WebContent folder?" Watch "How to know the absolute directory path of WebContent folder?" New topic
Author

How to know the absolute directory path of WebContent folder?

giang nguyen
Ranch Hand

Joined: May 13, 2003
Posts: 42
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


SCJP 1.4, SCWCD
Deepak Ramachandran Nair
Greenhorn

Joined: May 24, 2004
Posts: 4
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
 
subject: How to know the absolute directory path of WebContent folder?