hi,

write a little servlet that parses the config-file, set up your bean
and store it in the application-context.

In your jsp's you can then access it with scope="application", which is
fast!

To get your servlet executed at start-time, you can define it in your 
web.xml with a "load-at-startup"-parameter. Then it will be started by the 
servlet-engine as soon as it is ready.

hope this helps
Alexander

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 12, 2001 10:14 AM
To: [EMAIL PROTECTED]
Subject: Initalizing at startup and make global usable


Hi all,
I have to use an Array with my menuestructur global in my strutsapplication.
Therefor I implement an Class DynamicBean which initalizes the Array and
fills them all up by parsing an config file.

Up to now I put this call at any *.jsp-page. This is quite slow, because he
always should read the full config file and parse it for any jsp.

Here is my code example:

<% h2ouapp.DynamicBean menu= new h2ouapp.DynamicBean();%>

The constructor of this Class is then initalizing the array..

I then use this Array via the following call to produce the menue:

<% out.println(menu.moschreib());%>

So, how can I start the initalizing via startup of struts...
Should I use web.xml?
How can I make the array global accessible and can I then use it?

Can anybody give me a code example?

Reply via email to