Let’s Move on:
Built-in JSP Objects and Their Implementation Classes:
JSP Object Implementation Class
Cont ‘d … JSP Objects
These objects are implicitly created at the beginning of a page when
your JSP is invoked, and they directly reference objects in the underlying
They are always available to scriptlets and expressions.
a brief description
The request Object
The request object represents the current request from the browser and is a subclass of the
ServletRequest class. For most current implementations of JSP, the request object is an
instance of HttpServletRequest.
The response Object
Like the request object, the response object is usually a subclass of the HTTP-specific version
of ServletResponse. In other words, it is usually an instance of HttpServletResponse.
The out Object
The out object is responsible for writing responses back to the browser and is an instance of the
The session Object
The session object is an instance of HttpSession. Because there is an obvious dependence on
HTTP, this object is available only if your JSPs use HTTP.
The application Object
The application object is an instance of the ServletContext object. The names "application"
and "ServletContext" don't seem very similar, but if you recall what the ServletContext class
does, you'll see that it manages data at the application level.
Cont ‘d… a brief description
The pageContext Object
The pageContext object is an instance of the PageContext class. Many of the
items available through built-in variables are also available through the pageContext
The config Object
The config object gives you access to configuration information for your JSP and
is an instance of the ServletConfig class.
The page Object
The page object is rather peculiar because it is a reference to the current JSP. In
other words, it's like an alias for the this keyword in Java.
The exception Object
When you create an error page to deal with exceptions that occur during normal
JSP processing, you might need access to the exception that caused the error page to be
invoked. You can access that exception through the exception object.
JSP Request Object
Request Object in JSP is used to get the values that the client passes to the
web server during an HTTP request. The request object is used to take the value
from the client’s web browser and pass it to the server. This is performed using an
HTTP request such as: headers, cookies or arguments.
The class or the interface name of the object request is
The object request is written: Javax.servlet.http.httpservletrequest.
Methods of request Object: There are numerous methods available
for request Object. Some of them are:
JSP Response Object
The response object denotes the HTTP Response data. The result or the information of
a request is denoted with this object. The response object handles the output of the client.
This contrasts with the request object. The class or the interface name of the response object
The response object is written as : Javax.servlet.http.httpservletresponse.
The response object is generally used by cookies. The response object is also used
with HTTP Headers.
Methods of response Object: There are numerous methods
available for response object. Some of them are:
addHeader(String name, String value)
setHeader(String name, String value)
JSP Session Object
Session Object denotes the data associated with a specific session of user. The
class or the interface name of the object session is http.HttpSession.
The object session is written as: Javax.servlet.http.httpsession.
The previous two objects, request and response, are used to pass information
from web browser to server and from server to web browser respectively.The Session
object provides the connection or association between the client and the server. The
main use of Session Objects is to maintain states when there are multiple page
The main feature of session object is to navigate between multiple pages in a
application where variables are stored for the entire user session. The session objects
do not lose the variables and the value remains for the user’ session. The concept of
maintenance of sessions can be performed by cookies or URL rewriting. A detailed
approach of session handling will be discusses in coming sections.
Methods of session Object: There are numerous methods available
for session object. Some of them are:
JSP out object
JSP out object denotes the Output stream in the context of page. The class
or the interface name of the object out is jsp.JspWriter.
The out object is written as: Javax.servlet.jsp.JspWriter
The object that write to the JSP's output stream is defined by the out object.
Methods of out Object: There are numerous methods available for
out Object,some of them are :