Let's start with our servlet that will load on the server's start up:
@WebServlet(name = "LoadOnStartupServlet", urlPatterns = {"/LoadOnStartupServlet"}, loadOnStartup = 1)public class LoadOnStartupServlet extends HttpServlet { @Override public void init() throws ServletException { System.out.println("*******SERVLET LOADED WITH SERVER's STARTUP*******"); }}