6.5 JSP LIFECYCLE

It is reiterated that a JSP is converted into a Servlet, so in many aspects they share similar life cycles (Figure 6.1).

 

JSP lifecycle

 

Fig. 6.1 JSP lifecycle

 

However, they share different names. The initialization corresponds to jspInit(); Service corresponds to jspService(); and the destruction to jspDestroy(). The JSP is translated into a Servlet and compiled the first time it is changed/created. Subsequently, it is ready for requests.

6.5.1 JSP Service Methods

As mentioned earlier, a JSP script is translated into Servlet code and then compiled into a Java Servlet class. The methods that a custom Servlet overrides are its Service ...

Get Web Technology: Theory and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.