JSP LifeCycle :-


When a request comes in for a JSP Page for the first time, It goes through the following stages -



1- User makes a request for a JSP Page for first time.
2- Web Container converts the JSP file into Servlet class (from .jsp to .java file).
3- Web Container compiles the Servlet class (from .java to .class file).
4- Web Container loads the Servlet class and intialized it by calling jspInit() method.
5- At this stage class has became a fully fledged servlet and is ready to accept user requests.
6- Web Container assigned a thread for user request and calls _jspService() method. _jspService() generates the user response.
7- Web Container calls the jspDestroy() method just before the JSP Page is destroyed. After that JSP page becomes eligible for garbase collection.

Note - JSP Page conversion and compilation take place only once in the JSP Lifecycle when request comes in for the first time. After that it works exactly the same way as our old servlets.