Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 17827 invoked from network); 3 Dec 2001 15:46:40 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 3 Dec 2001 15:46:40 -0000 Received: (qmail 29885 invoked by uid 97); 3 Dec 2001 15:46:10 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 29848 invoked by uid 97); 3 Dec 2001 15:46:09 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 29828 invoked from network); 3 Dec 2001 15:46:09 -0000 Message-ID: <4135D07B3996D1118F3100805F8B0B0E02BC87C1@apollo.tecnomen.ie> From: Donie Kelly To: 'Tomcat Users List' Subject: RE: How to create global variables wich could be accessed by all jsp sites and servlet's? Date: Mon, 3 Dec 2001 15:46:29 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Have a look at system.properties eg: // Set up new system propeties sc = getServletContext(); RootPath = sc.getRealPath("/"); propFile = new FileInputStream(RootPath + "myapp.properties"); Properties p = new Properties(System.getProperties()); p.load(propFile); System.setProperties(p); Run this in some servlet init() method which "loads on startup" (see web.xml) A file like this will then be in your $TOMCAT/webapps/app directory myapp.properties # My variable myvar=myvalue You can access these variables with System.getProperty("myvar") Hope this helps Donie -----Original Message----- From: Sebastian Hagenbrock [mailto:sebastian.hagenbrock@eventim.de] Sent: 03 December 2001 14:36 To: Tomcat Maillist Subject: How to create global variables wich could be accessed by all jsp sites and servlet's? Hi, I've found nothing about how to save Variables wich are stored globally in reference to one context. Normally I handle the variables in session objects for each user. But I've some preferences wich should be read only once at the start of the tomcat server and then always only read by the classes/jsp sites. I need it, because the initialisation of these variables consumes much time, and i have running it now for each new created session object. But it is only needed once at the servers startup. How to do that? Thx SH PS: Sorry for my bad english. -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: