A JSP page services requests as a servlet. Thus, the life cycle and many of the capabilities of JSP pages (in particular the dynamic aspects) are determined by Java Servlet technology.
When a request is mapped to a JSP page, the web container first checks whether the JSP page’s servlet is older than the JSP page. If the servlet is older, the web container translates the JSP page into a servlet class and compiles the class. During development, one of the advantages of JSP pages over servlets is that the build process is performed automatically.
The steps in the life cycle of jsp page are:
1. Translation of JSP page into Servlet
2. Compilation of Translated JSP pages (which creates Class file)
3. Loading of Class file
4. Instantiation the servlet class
5. Initialization by invoking jspInit() method (To initialize the instance of servlet class)
6. RequestProcessing by invoking _jspService() method
7. Destruction by invoking jspDestroy() methods (To destroy the instance of servlet class)
No comments:
Post a Comment