JSP is a server side scripting language. JSP is used to develop web applications. We can do everything on JSP which we can do with Servlet. In JSP we can add the Java code inside the HTML tags.
There are three service methods provided by JSP:
public void jspInit()
public void _jspService(HttpServletRequest request, HttpServletResponse response)
public void jspDestroy()
Following is the Life-cycle of JSP :
Parsing JSP : JSP page is first compiled for the syntax or other errors.
Translation from JSP to Servlet : After successfully parsing, the JSP is translated to the Servlet or Java file.
Compiling the Servlet : In this phase converted Servlet is compiled to class file.
Class Loading : Loading the Servlet class into memory.
Installation : Creating Servlet instance in memory.
Initialization : In this phase JSP instance is initialized by calling the jspinit() method. The initialization is takes place only once when request comes first time.
Service : In this phase the jsp engine provides the service for the JSP request. On each time request will come jsp engine invoke the _jspService() method, and this will be responsible to process the request and provide the response to the client.
Destroy : In this phase jsp engine invoke the jspDestroy() method to do resource clean up.
0 Comment(s)