This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to get the path of the ContextRoot Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get the path of the ContextRoot" Watch "How to get the path of the ContextRoot" New topic
Author

How to get the path of the ContextRoot

Corey Harden
Greenhorn

Joined: Apr 27, 2009
Posts: 11
I'm creating a page that allows users to upload files to a server. I want the file upload location to be inside of an images folder in the root of the website. Is there a way to get the exact location of where the Root folder sits on the server so I can use that path to save to the images folder? I need to be able to this in a way that would make it portable. Thanks in advance!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Moved to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

javax.servlet.ServletContext#getRealPath(String)
Corey Harden
Greenhorn

Joined: Apr 27, 2009
Posts: 11
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the path of the ContextRoot
 
Similar Threads
How to upload a file?
image upload
write jboss service to perform a task at startup.
configurable location for avatars
is there any method for finding