Have a look at the ServletContext interface. You may want to search the
archives since this topic has been discussed at length.

Basically the ServletContext is the area where all Servlets/JSPs can access
'global' properties.

You may also elect to create a servlet that starts automatically whenever
your webserver starts. You could pass some default global variables as init
parameters that are stored in the servlet context.

The ServletContext could be an appropriate place to store a pool of database
connections. Again, check the archives as connection pooling has also been
discussed at length.

Archive lives at http://archives.java.sun.com/archives/jsp-interest.html

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Rehman Habib
Sent: Wednesday, February 02, 2000 5:39 AM
To: [EMAIL PROTECTED]
Subject: Global Properties


Hi there,

I started looking into JSP around a week ago and I think it has a lot of
potential.
I have only just subscribed to this forum and trust I will be welcome....

Anyway, enough of the babble, does anyone know how (or indeed if is
possible) to
have a set of global properties which are set when then webserver and tomcat
are
started ?
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
!!!

Regards,
Habib

===========================================================================
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

===========================================================================
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

Reply via email to