In most cases, you use the JSP expression language in conjunction with the Model View Controller (MVC) architecture in which the servlet creates the data and the JSP page displays the data. In such a scenario, the JSP page is only interested in the objects that the servlet created and the general bean access and collection access mechanisms are sufficient. Hence, implicit objects are created by the web container that is available to all the JSP pages. There are in total 9 Implicit objects
A list of the 9 implicit objects is given below:
|Implicit Object||Crossponding class|
It is used to write/print content in the browser.
out.print("Hello, Coder Sathii");
It is to get the data on a current JSP page that has been requested by the previous JSP page.
String name= request.getParameter("name");
Response object helps the user to give the response to the client after page load.
It is used for storing users’ data to make it available on other JSP pages till the user session is active.
It is used for getting application-wide initialized parameter(s) and to maintain useful data across whole JSP application.
The exception object is used to handle an exception for displaying the error messages. This object is only available to the JSP pages, which have isErrorPage set to true.
<!-- errorPage.jsp --> <%@ page isErrorPage="true" %> Exception occurred: <%= 25/0 %>
The page implicit object represents the JSP page itself. It is of type object and is rarely used in JSP pages.
The 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 to process of that page.
This is a Servlet configuration object and mainly used for accessing getting configuration information such as servlet context, servlet name, configuration parameters etc.