Servlet to obtain the absolute path of the project <br/> string filepath = This. getservletconfig (). getservletcontext (). getrealpath ("/"); <br/> absolute path of the root directory: request. getservletpath (); </P> <p> absolute path of the file: request. getsession (). getservletcontext (). getrealpath (request. getrequesturi () </P> <p> absolute path of the current web application: servletconfig. getservletcontext (). getrealpath ("/"); </P> <p> several methods for obtaining the servletcontext object: </P> <p> javax. servlet. HTTP. httpsession. getservletcontext () </P> <p> javax. servlet. JSP. pagecontext. getservletcontext () </P> <p> javax. servlet. servletconfig. getservletcontext () </P> <p> absolute path of the file: request. getsession (). getservletcontext (). getrealpath (request. getrequesturi () </P> <p> absolute path of the current web application: servletconfig. getservletcontext (). getrealpath ("/"); <br/>