0% found this document useful (0 votes)
142 views

JSP Implicit Objects

There are 9 implicit objects automatically available in JSP pages that provide access to useful information like the HTTP request and response, session data, application attributes, and more. These implicit objects include out, request, response, session, application, exception, page, pageContext, and config, each with their own purpose and example uses cases provided. The document lists the implicit objects, their classes, and brief descriptions of what each one is used for.

Uploaded by

Waqas Javed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views

JSP Implicit Objects

There are 9 implicit objects automatically available in JSP pages that provide access to useful information like the HTTP request and response, session data, application attributes, and more. These implicit objects include out, request, response, session, application, exception, page, pageContext, and config, each with their own purpose and example uses cases provided. The document lists the implicit objects, their classes, and brief descriptions of what each one is used for.

Uploaded by

Waqas Javed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JSP - Implicit Objects

implicit objects are created by the web container that are available to all the jsp pages.
There are in total 9 Implicit objects

A list of the 9 implicit objects is given below:

implicit objects Class


out javax.servlet.jsp.JspWriter
request javax.servlet.http.HttpServletRequest
response javax.servlet.http.HttpServletResponse
session javax.servlet.http.HttpSession
application javax.servlet.ServletContext
exception javax.servlet.jsp.JspException
Page java.lang.Object
pageContext javax.servlet.jsp.PageContext
Config javax.servlet.ServletConfig

Out: It can be used for writing content to the browser


Example: out.print(“Hello World”);

Request: Its purpose is to get the data on a JSP page which has been entered
by user on the previous JSP page.

Example: String name= request.getParameter("name");

Response: Response object helps the user to give the response to the client after page load.
Example: response.sendRedirect("http://studyeasy.org");

Session: It is used for storing user’s data to make it available on other JSP pages till the user
session is active.
Example: session.getAttribute(“name”);

Application: it is used for getting application wide initialized parameter(s) and to maintain
useful data across whole JSP application.
Example: application.getAttribute(“BuiltVer”);

Exception: This object is used in exception handling for displaying the error messages. This
object is only available to the JSP pages, which has isErrorPage set to true.
Example:

<!-- Exception.jsp -->


<%@ page isErrorPage="true" %>
Exception occurred: <%= 25/0 %>

Page: The page implicit object represents the JSP page itself. It is of type object. It is rarely used
in JSP pages.

pageContext: pageContext implicit object provides methods to access other implicit objects.
Specifically pageContext object has methods like getPage, getRequest, getResponse etc. It also
provides methods to set and get attributes. The scope of the pages attribute is the processing of
that page.

Config: This is a Servlet configuration object and mainly used for accessing getting
configuration information such as servlet context, servlet name, configuration parameters etc.
Example: String servletName=config.getServletName();

You might also like