logo

The JSP API


Show

Two Packages are there in JSP API, that are:

  1. javax.servlet.jsp
  2. javax.servlet.jsp.tagext

javax.servlet.jsp package

There are two interfaces and classes in the javax.servlet.jsp package. Two interfaces are given below:

  1. JspPage
  2. HttpJspPage

Classes are given below:

  • JspWriter
  • PageContext
  • JspFactory
  • JspEngineInfo
  • JspException
  • JspError

The JspPage interface

All the created servlet classes must execute the JspPage interface in reference to JSP specification. It expands the Servlet interface. Two life cycle methods are provided.

Methods of JspPage interface

  1. public void jspInit(): It is supplicated only once through the life cycle of the JSP when the JSP page is appealed initially. It is used to perform startlingly. It is identical to the init() way of Servlet interface.
  2. public void jspDestroy(): It is supplicated only once through the life cycle of the JSP prior to the JSP page being destroyed. It can be used to do a few clean up procedures.

The HttpJspPage interface

The HttpJspPage interface gives the single life cycle method of JSP. It enlarges the JspPage interface.

Way of HttpJspPage interface:

  1. public void _jspService(): It is supplicated each and every time when a request for the JSP page approaches the container. It is used to initiate the request. The underscore _ define that you cannot overrule this way.