The getRealPath("/") method finds the actual file path to your web context root. Once you have this, you can determine any other path relative to the context root. You can then pass this path into your DAO method.
From servlet/action/jsp you can't get the absolute path. You need to specify this a parameter to the Container. You can use context-param in web.xml to specify the absolute path to your webapp directory and use ServletConfig to get the init parameter.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com