How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE
1. Open NetBeansIDE.
2. Create a Java Web Project.
3. Create a Servlet (say StartupServlet).
4. Create a Class(say Message) and write method to call say
static void display() {
System.out.print("-------Hello--------");
}
5. In StartupServlet override init() method of GenericServlet
and write code calling display() Method in.
6. Change web.xml. Add a line i provided in the video.
7. Run your project.
8. Finish.
Thank You :)
#java #tomcat #programming #netbeanside #coding #developer #tips #tricks