How does a web container (like tomcat) handle .properties files for access by servlets?
For example, if a servlet needs to access some stored key-value pairs from a .properties file, where should this file be placed?
FileInputStream myPropertiesFile = new FileInputStream("myconfig"); Properties myProperties = new Properties(); myProperties.load(myPropertiesFile); // access properties from the object here... myPropertiesFile.close();
Where should this file be placed (for example, in case of tomcat) for the servlet to be able to read it?
Does the location change, if the class that needs to access the properties file is a web service? (Axis under tomcat)
Joined: Oct 04, 2003
Servlets can accesss properties files in the same way as java apps, the only thing you need to cater for is the new path.
Personally I put my properties file inside WEB-INF/conf . This is a snippet of code I use:
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.