File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 60041
    
  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: 60041
    
  65

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

Joined: Apr 27, 2009
Posts: 11
Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to get the path of the ContextRoot
 
Similar Threads
configurable location for avatars
is there any method for finding
How to upload a file?
write jboss service to perform a task at startup.
image upload