Thus, Servlet defines the contract between the JSP container and the JSP page
implementation class. When the HTTP protocol is used, the contract is described by the
HttpServlet class. Most pages use the HTTP protocol, but other protocols are allowed by this
The Protocol Seen by the JSP Page Author
The JSP specification also defines the contract between the JSP container and the JSP page
author. This is, what assumptions can an author make for the actions described in the JSP
The main portion of this contract is the
method that is generated automatically
by the JSP container from the JSP page. The details of this contract is provided in Chapter 4.
The contract also describes how a JSP author can indicate that some actions must be taken
methods of the page implementation occur. In JSP 1.1 this is
done by defining methods with name
in a declaration scripting
element in the JSP page. Before the first time a request is delivered to a JSP page a
method, if present, will be called to prepare the page. Similarly, a JSP container can reclaim
the resources used by a JSP page at any time that a request is not being serviced by the JSP
page by invoking first its
method, if present.
A JSP page author may
(re)define any of the Servlet methods through a declaration
The JSP specification reserves the semantics of methods and variables starting with jsp, _jsp,
jspx and _jspx, in any combination of upper and lower case.
The HttpJspPage Interface
The enforcement of the contract between the JSP container and the JSP page author is aided
by requiring that the Servlet class corresponding to the JSP page must implement the
interface (or the
interface if the protocol is not HTTP).
JavaServer Pages 1.1 Specification
November 30, 1999