Implicit objects in jsp are the objects that are created by the container automatically, we do not need to create them explicitly.
JSP Implicit Objects
Implicit objects in jsp are the objects that are
created by the container automatically, we do not need to create them
explicitly. Since these objects are created automatically therefore these are
known as the implicit objects. Implicit objects are used for different purposes.
Our own methods (user defined methods) can't access them as they are local to
the service method and are created at the conversion time of a jsp into a
servlet. But we can pass them to our own method if we wish to use them locally
in those functions.
There are nine implicit objects. Here is the list of
all the implicit objects:
- Application: This object is available at the
widest context level, that allows to share the same information between the
JSP page's servlet and any Web components contained in the same.
- Config: Config object allows to pass the
initialization data to a JSP page's servlet.
- Exception: Exception object allows the
exception data to be accessed only by designated JSP "error
- Out: This object allows us to access the
servlet's output stream.
- Page: This object is an instance of the JSP
page's servlet class that processes the current request.
- Pagecontext: Pagecontext is the context for
the JSP page itself that provides a single API to manage the various scoped
attributes. This API is extensively used if we are implementing JSP custom
- Request: Request object is used to access the
HTTP request data, and also provides a context to associate the
- Response: This object allows direct access to
the HTTPServletResponse class object.
- Session: Perhaps it is the most commonly used
object to manage the state contexts.