-
1. Re: 'user' configuration properties
tbfmicke Jul 23, 2002 2:36 PM (in response to ashields)The recommended way is to use the "env-entry" part of the ejb-jar.xml file. (Check DTD for where to put it).
For example with the following: (taken from 1.1 EJB spec)
<env-entry>
<env-entry-name>foo/name1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>value1</env-entry-value>
</env-entry>
You can look up the value with:
Context initCtx = new InitialContext();
Context myEnv = (Context)initCtx.lookup("java:comp/env");
// Get some more environment entries. These environment
// entries are stored in subcontexts.
String val1 = (String)myEnv.lookup(“foo/name1”);
This is the "standard" way to do things.
However, sometimes I have went with property files that contains the values instead. Mostly because we felt if would be simpler for users to change values using them.
Regards