JSP Life Cycle

Web container is responsible to manage the complete life cycle of JSP. 

JSP Life Cycle Methods: 

There are three methods involve in JSP life cycle---

  • public void _jspInit()
  • public void _jspService(HttpServletRequest res,HttpServletResponse res)
  • public _jspDestroy()

Here we explore it step by step
  • JSP will be translated to a servlet.
  • Translated servlet will be compile.
  • Compiled servlet class will be loaded into main memory
  • Servlet class will be instantiated by calling default constructor.
  • Container call "jspInt()" method to initialize the servlet instance.
  • Container call _jspService() method by passing request and response parameter.
  • Container call jspDestroy() method to destroy.