Rehman Habib wrote:
>
> 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
> !!!
In a servlet 2.2 (JSP 1.1) container, you can specify initialization parameters
for a servlet context. As long as you only need access to string values as
globally (within an application) this works fine. If you instead need access to
a shared resource, such as a connection pool, you can use a servlet that sets
it up and makes it available to the rest of the application as a context attribute.
I suggest you look at the Servlet 2.2 spec in addition to the JSP 1.1 spec,
since JSP inherits all features of servlets. In many applications you also want
to divide the tasks between servlets and JSP pages to get an application that's
easy to maintain.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
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