How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE
How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE
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
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 this line in web.xml
<load-on-startup>0</load-on-startup>
7. Run your project.
8. Finish.
Thank You :)
thanks
ReplyDeleteCan you please suggest me a good book for learning all this stuff ..thankyou
ReplyDelete