Java Reference
In-Depth Information
The
_jspService
method corresponds to the body of the JSP page. It is defined automatically
by the JSP processor and should never be redefined by the JSP author. It returns no value.
It has two parameters:
•
HttpServletRequest
•
HttpServletResponse
It throws these exceptions:
•
javax.servlet.ServletException
•
java.io.IOException
The
JspPage
Interface
public interface JspPage extends javax.servlet.Servlet
This is the interface that a JSP processor-generated class must implement.
This interface defines a protocol with three methods; only two of them,
jspInit()
and
jspDestroy()
, are part of this interface. The signature of the third method,
_jspService()
,
depends on the specific protocol used and cannot be expressed in a generic way in Java.
D
A class implementing this interface is responsible for invoking these methods at the appropri-
ate time based on the corresponding Servlet-based method invocations.
The
jspInit()
and
jspDestroy()
methods can be defined by a JSP author, but the
_jspService()
method is defined automatically by the JSP processor based on the contents of
the JSP page.
The
jspInit()
Method
public void jspInit()
The
jsp_init()
method is invoked when the
JspPage
is initialized. After the
JspPage
is ini-
tialized, the
getServletConfig()
method will return the desired value.
jsp_init()
is synony-
mous with the
init()
method of a servlet.
It has no parameters, returns no value, and throws no exceptions.
The
jspDestroy()
Method
public void jspDestroy()
The
jspDestroy()
method is invoked when the
JspPage
is about to be destroyed. It is synony-
mous with the
destroy()
method of a servlet.
It has no parameters, returns no value, and throws no exceptions.