开发者

How JSP and servlet is executed without main function?

I wonder a norm开发者_如何学Cal java code will show main not found error if it is executed without the main function but how JSP and servlet is executed without the main function. can anyone explain please?


Yes I agree with manoj.The JSP/Servlets are executed by Web Container.The basic definition of web container:-

Web Container specifies a runtime environment for web components that includes security, concurrency, lifecycle management, transaction, deployment, and other services.

Basically most Java Web Application Developers uses Tomcat as Web Container.

Article or A Simple Description about the web container can be found here.

Java gives some Web Containers to Download Link.


because they are executed by the container, not as standalone applications.


May be off topic but still can be helpful:

If we use main() method in Jsp/servlet the main() method will not execute throughout the life cycle.Generally JSP/Servlets executes under webcontainer only. Webcontainer executes JSP/servlet life cycle or callback methods only in order to execute JSP/Servlet.So throughout the life cycle of JSP/Servlet, the webcontainer will execute init(ServletConfig),service(ServletRequest,ServletResponse),destroy() methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜