Tuesday, October 5, 2010

Getting executing directory for Servlet web application

Hi ,

Some time we need to know the directory in which our web-app is running.In servlet this can be done using following code.

String webAppPath = req.getSession().getServletContext().getRealPath("//");


This is useful when you need to generate some file for other application.

No comments: