Usually you should put the properties file in the src folder so that your application can read the properties file when the application starts, the properties file is copied from the src folder to the classes folder. As far as you know, the classes folder should be the project's output folder, so it will be used as the classpath folder, and the application can load the properties file if it is on the classpath .
An example of getting properties from a class path:
Properties prop = new Properties(); try {
However, you can load properties if you know the file path in the file system, in this case use
prop.load(new FileInputStream("/path/to/myproperties.properties"));
If you are talking about struts.properties
The structure uses a number of properties that can be changed to suit your needs. To change any of these properties, specify the property key and value in the struts.properties file. The properties file can be found anywhere in the class path, but it is usually located in / WEB -INF / classes.
If you are looking for message resource properties, you can configure it in struts.properties or struts.xml , which is proposed later.
<constant name="struts.custom.i18n.resources" value="path/to/resources/MessageResources"/>
the value is the path to the src/path/to/resources/MessageResources.properties
If you're looking for the right way to customize your application, consider using EasyConf .
source share