Thursday 15 March 2018

Life cycle of a JSP Page

A JSP page is converted into Servlet by JSP translator. The translation of a JSP page to a Servlet is called Lifecycle of JSP. 
Following are the JSP Lifecycle phases

1.     Translation of JSP Page
2.     Compilation of JSP Page
3.     Classloading (class file is loaded by the classloader)
4.     Instantiation (Object of the Generated Servlet is created).
5.     Initialization ( jspInit() method is invoked by the container).
6.     Reqeust processing ( _jspService() method is invoked by the container).
7.     Destroy ( jspDestroy() method is invoked by the container).

Explanation:
JSP translator translates JSP code into a servlet class source file(.java),then compiles that into a java servlet class and the servlet class bytecode is loaded using class loader.The web Container  creates an instance of that servlet class. 
The initialized servlet can now service request. For each request the Web Container call the _jspService() method. When the Container removes the servlet instance from service, it calls the jspDestroy() method to perform any required clean up operation.
Note: jspInit(), _jspService() and jspDestroy() are the important life cycle methods of JSP.

1 comment:

  1. Python is an open-source, high level, interpreted programming language which offers great opportunities for object-oriented programming. Choosing a python training program from Red Prism Group, which is best training institute for python in noida.

    ReplyDelete

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...