Name
application
Synopsis
The application
variable contains a reference to a
ServletContext
instance. The
ServletContext
provides resources shared within a
web application. It holds attribute values representing the JSP
application scope. An attribute value can be an instance of any Java
class. It also defines a set of methods that a JSP page or a servlet
use to communicate with its container, for example, to get the MIME
type of a file, dispatch requests, or write to a log file. The web
container is responsible for providing an implementation of the
ServletContext
interface.
A ServletContext
is assigned a specific URI path
prefix within a web server. For example a context could be
responsible for all resources under http://www.mycorp.com/catalog. All requests
that start with the /catalog request path, which
is known as the context path, are routed to this
servlet context.
A single instance of a ServletContext
is available
to the all servlets and JSP pages in a web application, unless the
web application indicates that it is distributable. For a distributed
application, there’s a single instance of the
ServletContext
class per application per Java
Virtual Machine (JVM).
Synopsis
Variable name: |
application |
EL expression |
${pageContext.servletContext} |
Interface name: |
javax.servlet.ServletContext |
Extends: |
None |
Implemented by: |
Internal container-dependent class |
JSP page type: |
Available in both regular JSP pages and error pages |
Methods
-
public Object getAttribute(String name)
Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.