This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt 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 Introducing JavaFX 8 Programming this week in the JavaFX 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: 63342
    
  70

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: 63342
    
  70

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
 
It's not a secret anymore!