Running a servlet for a WAR file

I am deploying a .WAR file on Tomcat v5.5. I want to start a stream when starting a war file. So I am thinking about using Startup Servlet for this. But I do not know very well the servlet / start servlets. Can you guys tell me a little about how to do this? Any descriptive links on these issues would also be greatly appreciated. :)

+3
source share
2 answers

You can use javax.servlet.ServletContextListenerand configure it in web.xml, for example:

<listener>
    <listener-class> com.mycompany.Listener </listener-class>
</listener>

SerletContextListener - , . , ( ) .

+9

<load-on-startup>1</load-on-startup> 

, , . init init. , URL .

0

Source: https://habr.com/ru/post/1763026/


All Articles