سؤال

I wonder if you could help me with this:

At first sorry if I am asking something easy, but I am amateur in this.

I have a tomcat server in my computer and I have several services (programmed in java language with Eclipse) in it. What I would like to know is if it is possible to stablish a code that should be execute in each service when Tomcat server turns on or reset. If it is possible, how could I do that?

هل كانت مفيدة؟

المحلول

A ServletContextListener is meant for exactly this type of thing. Your implementation of contextInitialized() will be called when the server starts the "context" (meaning the webapp).

نصائح أخرى

You can create a Context Creation listener.(ServletContextListener)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top