How to create global variables wich could be accessed by all jsp sites and servlet's?

2001-12-03 Thread Sebastian Hagenbrock

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: 




RE: How to create global variables wich could be accessed by all jsp sites and servlet's?

2001-12-03 Thread Ikke List

You may want to use a properties file or much more 'mordern' nowadays,
create  XML file which hold the values.

The Properties class is easier to work with directly I think.

Wouter

-Original Message-
From: Sebastian Hagenbrock [mailto:[EMAIL PROTECTED]]
Sent: Monday, 03 December, 2001 15: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:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>





--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: How to create global variables wich could be accessed by all jsp sites and servlet's?

2001-12-03 Thread Donie Kelly

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:[EMAIL PROTECTED]]
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:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




AW: How to create global variables wich could be accessed by all jsp sites and servlet's?

2001-12-04 Thread Sebastian Hagenbrock

That's it...

Thank you very much.

SH

-Ursprüngliche Nachricht-
Von: Donie Kelly [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 3. Dezember 2001 16:46
An: 'Tomcat Users List'
Betreff: RE: How to create global variables wich could be accessed by
all jsp sites and servlet's?


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



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>