3.2.4
Using the 
extends
 Attribute
If the JSP page author uses 
extends
, the generated class is identical to the one shown in 
CODE EXAMPLE 3 2
, except that the class name is the one specified in the 
extends
 attribute.
The contract on the JSP page implementation class does not change. The JSP container 
should check (usually through reflection) that the provided superclass:
Implements HttpJspPage if the protocol is HTTP, or JspPage otherwise.
All of the methods in the 
Servlet
 interface are declared final.
Additionally, it is the responsibility of the JSP page author that the provided superclass 
satisfies:
The 
service()
 method of the Servlet API invokes the 
_jspService
() method.
The 
init(ServletConfig)
 method stores the configuration, makes it available as 
getServletConfig
, then invokes 
jspInit
.
The 
destroy
 method invokes 
jspDestroy
.
A JSP container may give a fatal translation error if it detects that the provided superclass 
does not satisfy these requirements, but most JSP containers will not check them.
3.3
Buffering
The JSP container buffers data (if the jsp directive specifies it using the buffer attribute) as it 
is sent from the server to the client. Headers are not sent to the client until the first 
flush
method is invoked. Therefore, none of the operations that rely on headers, such as the 
setContentType
, 
redirect
, or 
error
 methods are valid until the 
flush
 method is 
executed and the headers are sent.
JSP 1.1 includes a class that buffers and sends output, 
javax.servlet.jsp.JspWriter
. The 
JspWriter
 class is used in the 
_jspPageService 
method as in the following example:
i
mport javax.servlet.jsp.JspWriter;
static JspFactory _jspFactory = JspFactory.getDefaultFactory();
_jspService( request,  response) {
// initialization of implicit variables...
PageContext pageContext = _jspFactory.createPageContext(
this,
request,
79
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.