Adsense

Monday, 29 July 2013

JSP Questions

For the last couple of years, I have faced following questions::

1.Life-cycle:
Ans:
a)Page Translation:
Here from the JSP source file , the servlet is created.The container validates the JSP tags as well.The actions and directives are being interpreted by the container.

b)Page Compilation:
java servlet file--<compiled in to>--java servlet class

c)Loading and initialization:
Servlet class is loaded in to the container.
The jspInit() method is executed.
<%! public void jspInit(){ . . . }   %>

d)Execute _jspService():
This method is called for every request.We cannot override _jspService() method.
<%! public  _jspService(HttpServletRequest req, HttpServletResponse res) { . . . } %>

e)Execute jspDestroy():
This method permit us to specify resource cleanups like database disconnection.This is the final step of Jsp life cycle.
<%! public void jspDestroy(){ . . . } %>


No comments:

Post a Comment