How JSP functions or Lifecycle of JSP?
When a client requests a jsp , First time JSPs are converted into servlets and then compiled before they get executed. The code inside the JSP gets placed into the converted servlets service() method.
JSP has three methods which is automatically called when a JSP is requested.
1. jspInt() 2. jspDestroy() 3. sevice()
1. jspInt() : similar to init() method of a Servlet :- when a JSP is requested , jspInt() is called first.
2. jspDestroy() : similar to destroy() method of a servlet :- automatically called when a JSP terminates. can be used to cleanup the resources used during the execution (eg. disconnecting from database )
3. service() : similar to service() method :- automatically called and makes HTTP connection.
Read more...