Java Reference
In-Depth Information
Table 2-4. Scope Objects
Scope Objects
Servlet API
Accessible From . . .
javax.servlet.ServletContext
Application/web
context
Web components across the application
Subtype of javax.servlet.ServletRequest
Request
Web components that handle the request
javax.servlet.http.HttpSession
Session
Web components in a session
javax.servlet.jsp.JspContext
Page
The JSP page that creates the object
Note In addition to the standard servlet request, session, and application scopes, JSP adds a fourth scope
called page scope .
A JSP page can access some specific objects through scripting variables. These objects are
provided by the JSP container and are called implicit objects . These implicit objects can be
accessed in scriptlets, in expressions, or as part of the EL expressions. (The EL expressions are
introduced in Chapter 3.) Table 2-5 lists the nine implicit objects with the corresponding API.
Table 2-5. Implicit Objects
Implicit Object
Usage
API
application
ServletContext
Accesses application-level objects
config
ServletConfig
Provides configuration information
exception
JSPException
Accesses error status
out
JSPWriter
Accesses the JSP output stream
page
Object
Provides a reference to the current JSP
pageContext
PageContext
Accesses the JSP container
request
ServletRequest
Provides access to the client request
response
ServletResponse
Provides access to the JSP response
session
HttpSession
Shares information across client requests
These implicit objects are described in more detail in the following sections.
application
The implicit application object provides a reference to the javax.servlet.ServletContext interface.
The ServletContext interface is used to provide access to any context-initialization parameters that
have been configured for the JSP page via the deployment descriptor of the web application. The
ServletContext object and parameters stored in them by the web container are available to the
entire web application. The application object provides the developer of the JSP page with access
to the ServletContext object.
 
 
Search WWH ::




Custom Search