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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61084
    
  66

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: 61084
    
  66

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