Well, there is a way: ServletContext.getRealPath(). BUT: this method is not supported by all servelt containers, but only by these ones which extract WAR files to the file system (as Tomcat). It is very dangerous to e.g. do write-access to the web application directory for clustered scenarios.
If the background of your question is, to write files which can be later on accessed by a URL...: then your application will not operate smoothly in a clustered application server environment. (The session might migrate from one server to the next...).