You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arne Brutschy <ma...@studserv.uni-leipzig.de> on 2004/02/02 13:59:43 UTC
[OT] looking for a method that will be called on application startup
hi,
I'm looking for a method/hook/whatever that will be called from tomcat
at application startup. I want to use it to put all my init-stuff (as
configuration reading) into it.
At the moment, my authentication filter looks for the presence of these
objects in application scope, and if they are not found, they will be
created.
Is there another way to do this more nicly?
Regards,
Arne
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [OT] looking for a method that will be called on application
startup
Posted by Arne Brutschy <ma...@studserv.uni-leipzig.de>.
Thanks guys! That was exactly what I was looking for - and it works like
magic. Great, thanks again!
Arne
Robert Taylor wrote:
> The ServletContextListener does exactly what you want.
> When the web application starts the
> ServletContextListener.contextInitialized() is
> invoked passing you ServletContextEvent which contains the ServletContext.
> These are guaranteed to be invoked before the web application can process
> any requests. It's simply an interface which you implement (2 methods) then
> define in your
> web.xml file.
>
> For more information refer to the Servlet 2.3 spec or higher.
> http://java.sun.com/aboutJava/communityprocess/first/jsr053/index.html
>
> robert
>
>
>>-----Original Message-----
>>From: Otávio Augusto [mailto:otavio.augusto@bol.com.br]
>>Sent: Tuesday, February 03, 2004 8:39 AM
>>To: Struts Users Mailing List
>>Subject: Re: [OT] looking for a method that will be called on
>>application startup
>>
>>
>>do you mean a single implementation of a servlet, with methods
>>which fit each developer needs, and declaring this servlet in the
>>appropriate place in the web.xml file? doesn't this servlet need
>>anything special? I ask that because I've never made a
>>ContextListener, and I also need a "first time verification" in my app.
>>
>>Thanks
>>
>>Otávio Augusto
>>
>>On Mon, 02 Feb 2004 14:07:47 +0100
>>Marcel Schepers <ma...@libereco.biz> wrote:
>>
>>
>>>Hi Arne,
>>>
>>>A solution could be create an initialization servlet. Include that
>>>servlet in your web.xml and make sure you provide a <load-on-startup>
>>>parameter.
>>>
>>>Marcel
>>>
>>>On Mon, 2004-02-02 at 13:59, Arne Brutschy wrote:
>>>
>>>>hi,
>>>>
>>>>I'm looking for a method/hook/whatever that will be called
>>
>>from tomcat
>>
>>>>at application startup. I want to use it to put all my init-stuff (as
>>>>configuration reading) into it.
>>>>
>>>>At the moment, my authentication filter looks for the
>>
>>presence of these
>>
>>>>objects in application scope, and if they are not found, they will be
>>>>created.
>>>>
>>>>Is there another way to do this more nicly?
>>>>
>>>>Regards,
>>>>Arne
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: accessing application.properties from JSP
Posted by James Mitchell <jm...@apache.org>.
Serverside jsp processing knows nothing about embedded JavaScript or
anything else.
<bean:message .../> works anywhere on your page (if you remember to put the
taglib declaration)
--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017 (cell)
AIM: jmitchtx
MSN: jmitchell@apache.org
----- Original Message -----
From: "Marco Mistroni" <mm...@waersystems.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Tuesday, February 03, 2004 12:01 PM
Subject: RE: accessing application.properties from JSP
> Hi,
> Actually my problem is that I have to make so that a javascript
> message can be internationalized, so I must get it from
> application.properties.
>
> But it looks like writing a <bean:message > inside a javascript method
> Does not work.....
>
> Any workarounds?
>
> I assume that message resources are stored in servlet context.. if so,
> under
> Which name?
>
> Thanx and regards
> marco
>
> -----Original Message-----
> From: James Mitchell [mailto:jmitchell@apache.org]
> Sent: 03 February 2004 15:09
> To: Struts Users Mailing List
> Subject: Re: accessing application.properties from JSP
>
> The same way it is done in the struts-example.
>
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (cell)
> AIM: jmitchtx
> MSN: jmitchell@apache.org
>
>
>
> ----- Original Message -----
> From: "Marco Mistroni" <mm...@waersystems.com>
> To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
> Sent: Tuesday, February 03, 2004 10:06 AM
> Subject: accessing application.properties from JSP
>
>
> > Hi all,
> > Does anyone know how to access application.resources from a JSP?
> > With best regards
> > Marco
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: accessing application.properties from JSP
Posted by Marco Mistroni <mm...@waersystems.com>.
Hi,
Actually my problem is that I have to make so that a javascript
message can be internationalized, so I must get it from
application.properties.
But it looks like writing a <bean:message > inside a javascript method
Does not work.....
Any workarounds?
I assume that message resources are stored in servlet context.. if so,
under
Which name?
Thanx and regards
marco
-----Original Message-----
From: James Mitchell [mailto:jmitchell@apache.org]
Sent: 03 February 2004 15:09
To: Struts Users Mailing List
Subject: Re: accessing application.properties from JSP
The same way it is done in the struts-example.
--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017 (cell)
AIM: jmitchtx
MSN: jmitchell@apache.org
----- Original Message -----
From: "Marco Mistroni" <mm...@waersystems.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Tuesday, February 03, 2004 10:06 AM
Subject: accessing application.properties from JSP
> Hi all,
> Does anyone know how to access application.resources from a JSP?
> With best regards
> Marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: accessing application.properties from JSP
Posted by James Mitchell <jm...@apache.org>.
The same way it is done in the struts-example.
--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017 (cell)
AIM: jmitchtx
MSN: jmitchell@apache.org
----- Original Message -----
From: "Marco Mistroni" <mm...@waersystems.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Tuesday, February 03, 2004 10:06 AM
Subject: accessing application.properties from JSP
> Hi all,
> Does anyone know how to access application.resources from a JSP?
> With best regards
> Marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
accessing application.properties from JSP
Posted by Marco Mistroni <mm...@waersystems.com>.
Hi all,
Does anyone know how to access application.resources from a JSP?
With best regards
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [OT] looking for a method that will be called on application startup
Posted by Robert Taylor <rt...@mulework.com>.
The ServletContextListener does exactly what you want.
When the web application starts the
ServletContextListener.contextInitialized() is
invoked passing you ServletContextEvent which contains the ServletContext.
These are guaranteed to be invoked before the web application can process
any requests. It's simply an interface which you implement (2 methods) then
define in your
web.xml file.
For more information refer to the Servlet 2.3 spec or higher.
http://java.sun.com/aboutJava/communityprocess/first/jsr053/index.html
robert
> -----Original Message-----
> From: Otávio Augusto [mailto:otavio.augusto@bol.com.br]
> Sent: Tuesday, February 03, 2004 8:39 AM
> To: Struts Users Mailing List
> Subject: Re: [OT] looking for a method that will be called on
> application startup
>
>
> do you mean a single implementation of a servlet, with methods
> which fit each developer needs, and declaring this servlet in the
> appropriate place in the web.xml file? doesn't this servlet need
> anything special? I ask that because I've never made a
> ContextListener, and I also need a "first time verification" in my app.
>
> Thanks
>
> Otávio Augusto
>
> On Mon, 02 Feb 2004 14:07:47 +0100
> Marcel Schepers <ma...@libereco.biz> wrote:
>
> > Hi Arne,
> >
> > A solution could be create an initialization servlet. Include that
> > servlet in your web.xml and make sure you provide a <load-on-startup>
> > parameter.
> >
> > Marcel
> >
> > On Mon, 2004-02-02 at 13:59, Arne Brutschy wrote:
> > > hi,
> > >
> > > I'm looking for a method/hook/whatever that will be called
> from tomcat
> > > at application startup. I want to use it to put all my init-stuff (as
> > > configuration reading) into it.
> > >
> > > At the moment, my authentication filter looks for the
> presence of these
> > > objects in application scope, and if they are not found, they will be
> > > created.
> > >
> > > Is there another way to do this more nicly?
> > >
> > > Regards,
> > > Arne
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [OT] looking for a method that will be called on application
startup
Posted by Otávio Augusto <ot...@bol.com.br>.
do you mean a single implementation of a servlet, with methods which fit each developer needs, and declaring this servlet in the appropriate place in the web.xml file? doesn't this servlet need anything special? I ask that because I've never made a ContextListener, and I also need a "first time verification" in my app.
Thanks
Otávio Augusto
On Mon, 02 Feb 2004 14:07:47 +0100
Marcel Schepers <ma...@libereco.biz> wrote:
> Hi Arne,
>
> A solution could be create an initialization servlet. Include that
> servlet in your web.xml and make sure you provide a <load-on-startup>
> parameter.
>
> Marcel
>
> On Mon, 2004-02-02 at 13:59, Arne Brutschy wrote:
> > hi,
> >
> > I'm looking for a method/hook/whatever that will be called from tomcat
> > at application startup. I want to use it to put all my init-stuff (as
> > configuration reading) into it.
> >
> > At the moment, my authentication filter looks for the presence of these
> > objects in application scope, and if they are not found, they will be
> > created.
> >
> > Is there another way to do this more nicly?
> >
> > Regards,
> > Arne
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [OT] looking for a method that will be called on application
startup
Posted by Marcel Schepers <ma...@libereco.biz>.
Hi Arne,
A solution could be create an initialization servlet. Include that
servlet in your web.xml and make sure you provide a <load-on-startup>
parameter.
Marcel
On Mon, 2004-02-02 at 13:59, Arne Brutschy wrote:
> hi,
>
> I'm looking for a method/hook/whatever that will be called from tomcat
> at application startup. I want to use it to put all my init-stuff (as
> configuration reading) into it.
>
> At the moment, my authentication filter looks for the presence of these
> objects in application scope, and if they are not found, they will be
> created.
>
> Is there another way to do this more nicly?
>
> Regards,
> Arne
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [OT] looking for a method that will be called on application startup
Posted by Robert Taylor <rt...@mulework.com>.
javax.servlet.ServletContextListener
robert
> -----Original Message-----
> From: Arne Brutschy [mailto:mai01cvr@studserv.uni-leipzig.de]
> Sent: Monday, February 02, 2004 8:00 AM
> To: Struts Users Mailing List
> Subject: [OT] looking for a method that will be called on application
> startup
>
>
> hi,
>
> I'm looking for a method/hook/whatever that will be called from tomcat
> at application startup. I want to use it to put all my init-stuff (as
> configuration reading) into it.
>
> At the moment, my authentication filter looks for the presence of these
> objects in application scope, and if they are not found, they will be
> created.
>
> Is there another way to do this more nicly?
>
> Regards,
> Arne
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org