JSP API
JSP API
An API is a collection of packages, classes, interfaces and sub-packages. And sub-package is also a collection of classes interfaces and sub sub packages etc.
The JSP API consists of two packages;
- javax.servlet.jsp
- javax.servlet.jsp.tagext
javax.servlet.jsp package
The javax.servlet.jsp package has two interfaces and some classes.
Interfaces are;
- JspPage
- HttpJspPage
classes are;
- JspWriter
- JspError
- PageContext
- JspFactory
- JspEngineInfo
- JspException
JspPage Interface
JspPage interface has provided two lifecycle methods.
public void jspInit(): This method is invoked only once during the life cycle of the JSP when first request is come to JSP page is requested. It is used to perform initialization. This method is same as the init() method of Servlet
public void jspDestroy(): This method is invoked only once during the life cycle of the JSP before the JSP page is destroyed.
HttpJspPage interface
HttpJspPage interface provided a single life cycle method called _jspService().
public void _jspService(): This method is invoked each time when request for the JSP page comes to the container. It is used to process the request. The underscore _ signifies that you cannot override this method.