-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

David Kerber wrote:
> Previously, I had been using the java Preferences class, which stores
> things in a way that is transparent to the java program (in the
> registry on windows, elsewhere on other OS's).

IMHO, the Java Preferences class is a travesty for exactly that reason.
It would have been great if they had allowed the developer to choose the
method of storage (Windows-style INI file, Windows Registry, JNDI, Java
properties file, UNIX run-control, whatever), but they didn't. :(

> I much prefer text files for configs, but for a long time didn't know
> there were built-in capabilities for this in java, and didn't want to
> bother to roll my own.

Light dawns. Everything in java.util is really good stuff. Well, almost.
Maybe not "Date" and "StrinkTokenizer". But everything else is good, I
swear!

java.util.Properties and java.util.ResourceBundle are very similar. In
fact, I'm not entirely sure why they are not more closely related. You
can use the Properties class to load a properties file (using
Properties.load()), but you can use ResourceBundle.getBundle to load a
properties file from the classpath and /get the right Locale for those
properties/. This is important if you are considering providing
locale-specific properties (like translations of strings).

If you use ResourceBundle.getBundle, then you don't even need to worry
about ServletContext.getResourceAsStream or anything like that. Just put
your properties files into WEB-INF/classes, or into a JAR file in
WEB-INF/lib, and ResourceBundle will locate and load your file for you.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFulzX9CaO5/Lv0PARAokNAKCmmO2LHjXST9M6b7olPU2VsoMpugCaA+Su
nZCv9JO6xo0EvE1eeMs1Jcg=
=Gi6J
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to