I have written a simple servlet with init() and doGet(), doPost() method. I have a requirement, that I have an API which i need to invoke an server startup.
Is it possible to do so. I tried with init method, and setting default values in web.xml, but i am still unable to do so.
Please tell if I am missing something.
Thanks
Have you set the load-on-startup attribute to be positive?
Alternatively, you might want to use a ServletContextListener to do initialisation work when the container comes up. This is the ‘de facto’ standard for having a callback to do some initialisation work when the servlet container comes online e.g. we use that to read in some XML files and populate a cache.