tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kitching Simon <>
Subject RE: Web Application initialization on startup
Date Fri, 15 Sep 2000 15:17:55 GMT

> -----Original Message-----
> From:
> []
> Sent:	Friday, September 15, 2000 5:10 PM
> To:
> Subject:	Web Application initialization on startup
> Hi,
> I would like to execute some initialization code each time I start Tomcat
> or redeploy my Web Application.
> Specifically, in the startup process, I would like to create several
> JavaBeans of the  application scope.
> Those JavaBeans will be accessed by the JSP pages.
> I tried putting this iniatialization code into the starting JSP page of my
> application, but it's not convenient: each time I restart Tomcat (or
> application) I will have to access that page in order to get things
> initialized.
> I was hoping to find some way of telling Tomcat to execute some code each
> time the application starts.
> Is there any way to do that? If not, what are possible workarounds?
> Thanks,
> Faustas
	[Kitching Simon]  

	Recently, I've been through exactly the same steps. Even to the
	that having to visit a particular jsp page after startup just wasn't
going to
	cut it in production.

	Finally, I put all the initialisation code into a servlet, and set
	servlet to start up on load.

	Attached are the relevant files....

	Hope this helps.


>  <<web.xml>>  <<>>  <<>>

	[Kitching Simon]  

	By the way, the initialisation is split into a servlet & a bean
because we
	also use an IDE that cannot be told to run a servlet on startup, so
we still
	have the "visit the initialise page" procedure when using the IDE;
	initialise page now just calls the bean.

	PPS: this code is still in development, so it is a bit rough in

View raw message