An instance of a PageContext is created by a JSP container specific implementation class at 
the beginning of it's 
_jspService()
 method via an implementation specific default 
JspFactory
, as shown in 
FIGURE F 1
:
FIGURE F 1 
Using PageContext to Provide Implementation Independence
public void _jspService(HttpServletRequest request,
 HttpServletResponse response)
throws IOException, ServletException {
JSPFactory  factory     = 
JSPFactory.getDefaultFactory();
// Get the page context object for this page
PageContext pageContext = factory.getPageContext(
this,
request,
response,
null, // e.g. no errorPageURL,
false, // e.g. no session
JspWriter.DEFAULT_BUFFER,
true // autoflush=true
);
// Initialize implicit variables for scripting
HttpSession session = pageContext.getSession();
JspWriter   out     = pageContext.getOut();
Object      page    = this;
try {
// body of JSP here ...
} catch (Exception e) {
out.clear();
pageContext.handlePageException(e);
} finally {
out.close();
factory.releasePageContext(pageContext);
}
}
6.1.4.2
Usage
The PageContext object provides access to multiple functionality
Appendix 6
JSP Technology Classes
118




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




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