We put one object in the ServletContext to hold "global variables", so the classes 
don't necessarily get a reference to the ServletContext itself, but to this
object. Mainly it was to avoid messing up the application namespace with a bunch of 
variables that may or may not get used, typechecked, etc.

4/6/2001 4:22:34 PM, Rodrigo Gevaerd <[EMAIL PROTECTED]> wrote:

>  I got an application that has several constants (for example, database
>url). The application consists of several JSPs for presentation and classes
>for the persistence. How can I keep the application constants, so that 2
>applications of this type (with different constants values) can co-exist in
>the same JVM (possibly in different web applications)? It was developed
>initially keeping the constants in a singleton class. But with more than one
>application it cannot be done like that. The constants could be kept in the
>ServletContext, but the classes would not have access to them (unless each
>were given the SerlvetContext reference). Does anyone has any idea for a
>solution for this situation?
>
>    []'s,
>    Rodrigo.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to