Gregory Krasnow wrote:
> If your servlet is opening a PropertyResourceBundle, where should the
> properties file live? If the servlet is in a package, should it be in
> the folder that contains the class file for the servlet, or at the root
> of the servlet folder? or somewhere else?
>
> - Greg
>
Property resource bundles follow the same package naming rules that Java
classes do. Let's assume we have a package named "my.package", so a Java
class in that package would be in directory
./my/package/MyClass.java
./my/package/MyClass.class
Then, if you ask for a property resource bundle named
"my.package.MyResources" you will grab the properties file at
./my/package/MyResources.properties
(or, if your locale said to grab the French language version instead, it
would grab):
./my/package/MyResources_fr.properties
In each case, the "." is usually the current working directory during
development. At runtime, this is the directory that you declared in the
"repositories" line of your zone properties file.
The other thing you might do is just ask for a bundle named
"MyResources". In that case, the properties file itself should be in the
"." directory -- just the place you would put a Java .class file for a
class that was not part of any package at all.
This mechanism works even if you package up the .class and .properties
files into a JAR file, as long as the appropriate directory nesting (i.e.
same as for classes in that package) is followed.
Craig McClanahan
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]