| |
GeekInterview.com > Interview Questions > J2EE > JSP
| Print | |
Question: Why main() is not written in servlets programs?
|
| July 07, 2008 10:12:15 |
#6 |
| mullangi13 |
J2EE Expert Member Since: March 2007 Total Comments: 6 |
RE: Why main() is not written in servlets programs? |
Servlet will execute in webcontainer only. The life cycle of servlet is
init(ServletConfig cg) service(ServletRequest,ServletResponse) destroy()
So our webcontainer will call these methods only to execute our servlet. So even you defined main() method in your servlet there is no wrong but there is no use why because it never execute throughout the servlet life cycle.
Rgds, Mullangi |
| |
Back To Question | |