Implicit Objects


The objects are created by the web container which are available to all the jsp pages are known as Implicit Objects.
The available implicit objects are out, request, config, session, application etc.

JSP supports nine implicit objects given below:

• out :
The out implicit object is an instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response.

• request :
The request object is an instance of a javax.servlet.http.HttpServletRequest object. Each time a client requests a page the JSP engine creates a new object to represent that request.

• application :
The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object.

• page :
This object is an actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page.

• exception :
The exception object is a wrapper containing the exception thrown from the previous page. It is typically used to generate an appropriate response to the error condition.

• response :
The response object is an instance of a javax.servlet.http.HttpServletResponse object. Just as the server creates the request object, it also creates an object to represent the response to the client.

• config :
The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet.

• session :
The session object is an instance of javax.servlet.http.HttpSession and behaves exactly the same way that session objects behave under Java Servlets.

• pageContext :
The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.

Basic Flow showing the use implicit objects:


The following code snippet contains a few implicit objects: