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 
specification.
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 
page.
The main portion of this contract is the 
_jspService() 
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 
when the 
init() 
and 
destroy()
 methods of the page implementation occur. In JSP 1.1 this is 
done by defining methods with name 
jspInit()
 and 
jspDestroy()
 in a declaration scripting 
element in the JSP page. Before the first time a request is delivered to a JSP page a 
jspInit()
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 
jspDestroy()
 method, if present.
A JSP page author may 
not
 (re)define any of the Servlet methods through a declaration 
scripting element.
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 
HttpJspPage
 interface (or the 
JspPage
 interface if the protocol is not HTTP).
73
JavaServer Pages 1.1 Specification  
November 30, 1999




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.