What is the Lifecycle Stages of JSP ?

JSP has following lifecycle stages...

1 - Compilation : When a request is made for a JSP, the corresponding JSP is converted into Servlet and compiled. If there is already a compiled form of JSP and there is not change in JSP page since last compilation, this stage does not do anything.

2 - Initialization : In this stage, jspInit() method is called to initialize any data or code that will be later used multiple times in _jspService() method.

3 - Service : In this stage, with each request to JSP, _jspService() method is called to service the request. This is the core logic of JSP that generates response for request.

4 - Destroy : In this stage, JSP is removed from the container/server. Just before removal, this stage performs the cleanup of any resources held by JSP

You May Interest

What is the Different Type of Tag Library Groups in JSTL ?

What is the Difference Between Abstract Class and Interface in Ja ...

What is the Use of Interceptor Design Pattern in Java ?

How Can Be Read Data From a Form in a JSP ?

How Will You Include a Static File in a JSP Page ?