I think you can do your initialisation in the init() method of the servlet.
C�dric
-----Message d'origine-----
De : struts (H2Opilot) [mailto:[EMAIL PROTECTED]]
Envoy� : mercredi 12 septembre 2001 10:41
� : [EMAIL PROTECTED]
Objet : AW: Initalizing at startup and make global usable
hi,
this was also my Idea, but I still down't know how to start the servlet in
the XML.
And I also down't know how to set the Array's with in the java-Class file.
And later I down't know how to reuse the Array's in the jsp-File to forward
it to the jsp-file witch is producing the menue via out.println.
Can U give me a simple Code-Example?
-----Urspr�ngliche Nachricht-----
Von: Alexander Jesse [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 12. September 2001 10:31
An: struts-user; struts
Betreff: RE: Initalizing at startup and make global usable
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?

