wellnwill

JSP

JSP lifecycle methods

There are mainly three JSP lifecycle method:

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

JSP lifecycle steps

  • Container translates the JSP to Servlet (welcome.jsp -> welcome_jsp.java)
  • Container compile translated servlet (welcome_jsp.java -> welcome_jsp.class)
  • Container loads servlet class
  • Container invokes lifecycle method _jspinit() for initialization
  • Container invokes lifecycle method _jspService()
  • On further client request container directly invokes _jspService()
  • On container shut down, container invokes _jspDestroy()
Footer with Map