In this section we will discuss about life cycle of JSP.
Like the each Java based web technology JSP also follows a life cycle for the execution of an application. Life cycle of any technology expresses that the execution of any application should be passed through the specified phases. In the core of the JSP, Java Servlet technology is executed therefore, JSP life cycle is likely to Java Servlet technology. A Servlet container controls the following processes when a request is mapped to a Servlet :
But, what for a request mapped to a JSP page. It is quite different of request mapping to a Servlet and request mapping to a JSP page. As we have discussed above a Servlet container controls the processes when a request is mapped to a Servlet but, when a request is mapped to a JSP page a special Servlet controls as, at first it checks the version of Servlet and JSP that whether the Servlet of JSP page is older than the JSP page or not. If it is older then the JSP page is translated into the Servlet class and then it is compiled. In JSP build process is performed automatically whereas, in Servlet it is not performed automatically. Life Cycle of JSP helps in understand its low-level functionality. JSP life cycle explains the process from its creation to destruction. As we have discussed already, the life cycle of JSP is likely to Servlet life cycle are described as follows :
JSP life cycle methods are as follows :
Following image is demonstrating the life cycle of JSP.
Liked it! Share this Tutorial