![]() |
Life Cycle of JSP![]() ![]() ![]() ![]() ![]()
JSPs are compiled into servlets. After a JSP is compiled, its lifecycle is similar to the servlet lifecycle.
Step: 1 Java source generation and compilation Step:2 When the Web Server (its servIet engine) receives a request for a JSP file, it passes the request to the JSP processor (PageCompileServlet). If this is the first time the JSP file has been requested or if the compiled copy of the JSP is not found, the JSP compiler generates and compiles a Java source file for the JSP file. The JSP processor puts the Java source and class file in the page compiler directory, By default, the JSP syntax in a JSPfile is converted to Java code that is added to the service() method of the generated class file. If you need to specify initialization parameters for the servlet or other initialization information, add the method directive set to the value inits. Step:3 Request processing After the JSP processor places the servIet class file in the page compile directory, the servIet engine creates an instance of the servIet and calls the servlet service() method in response to the request. All subsequent requests for the JSP are handled by that instance of the servIet. When the servlet engine receives a request for a JSP file, the engine checks to determine whether the JSP file (.jsp) has changed since it was loaded. If it has changed, the servlet engine reloads the updated JSP (that is, generates an updated Java source and class file for the JSP). The newly loaded servlet instance receives the client request. Step:4 Termination When the servlet engine no longer needs the servIet or a new instance of the servlet is being reloaded, the servIet engine invokes the servlet's destroy() method. The servlet engine can also call the destroy() method if the engine needs to conserve resources or a pending call to a servIet service() method exceeds the timeout. The Java Virtual Machine performs garbage collection after the destroy. The figure shown below summarizes the major life events in a JSP. The page is initialized by invoking the jsplnit() method. This initializes the JSP much in the same way as servlets. "Every time a request comes to the JSP, the container generated _jspService() method is invoked, the request is processed and the JSP generates the appropriate response. This is sent back to the client. When the JSP is destroyed by the server, the jspDestroyo method, is invoked to perform any clean up.
|
|
Domain NamesJSP Java Web Server Installation Java Web Server Administration The Initial Screens The Setup Button The Monitoring Button The Security Button The Servlets Button JSP Technology Evolution of Dynamic Content Technologies Features of JSPJSP Versus Servlets JSP Versus ASP Defining JSP Implementation Life Cycle of JSP JSP Application Models Writing your First Java Server Pages File
JSP Directives
JSP Declarations
JSP Scriptlets
JSP Expressions
Standard ActionsWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |