Java Server Page Life Cycle

JSP (Java Server Page) -
    JSP means java server page with in the JSP you can write java code with in html code.

    Ex -
    <html>
        <body>
        <%
            System.out.println(“This is my first JSP Page”);
        %>
        </body>
    </html>

    When any request will go for any jsp firstly JSP creates a Servlet for JSP and compiles to .class file then run over the web server.

JSP Life Cycle -
    There are three methods defines Life Cycle of JSP Page.
1._jspInit()
2._jspService()
3._jspDestroy()


_jspInit() Method -
_jspInit() method is called by jsp container for initializing the servlet of jsp page. This method is call at one time of any JSP life.

_jspService() Method- 
_jspService() method is called when any request is send by the client for providing the response on this JSP Page.


_jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

_jspDestroy() Method - 
_jspDestroy() method is called by jsp engine when server has gone to shut down. Like jspInit() method, you can override the jspDestroy() method also to do your all clean up such as release the resources

Comments

Recent Post

Recent Posts Widget

Popular posts from this blog

Capture image from webcam java code, examples

How to capture finger prints in java

Shallow Copy Deep Copy Java example