You don't need to rely on the servlet engine for this, and you certainly
don't need to hard-code these values in any of your classes. You should
implement a singleton design pattern "properties" class that loads
itself with information from a .properties file -- a fairly simple
wrapper around java.util.PropertyResourceBundle. You probably want to
provide some convenience methods that gets values as doubles, integers,
... Typical usage would look like:
com.db.Configuration config = com.db.Configuration.getInstance();
String myServerName = config.getString("serverName");
int myServerPort = config.getInt("serverPort");
The relevant properties file would look like:
serverName=bubba
serverPort=5000
Rehman Habib wrote:
> For example, I work with a global website with multiple webservers and each has
> a connection to a local database. It would be nice to define the TNS name as a
> property for each webserver which is then used by the class which performs the
> connection to the database. If this isn't possible then I would have to hard
> code it into the class and have a different copy for each webserver - very nasty
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html