I'm trying to figure out how access an XML file with FileReader somewhere in my webapps's directory without resorting to absolute file paths. Is there a way to have a custom config file in, say, WEB-INF and be able to load that without specifying the full path?
posted 11 years ago
You can use the ServletContext object's getRealPath() method to find the actual path for a given virtual path. So, to get the actual path for your context root, you'd code the following in your Actoin class: