Implicit Objects In JSP

In this section we will read about the implicit objects in JSP. This section will describe you the various implicit objects defined in JSP.

Implicit Objects In JSP

Implicit Objects In JSP

In this section we will read about the implicit objects in JSP.

This section will describe you the various implicit objects defined in JSP. These implicit objects are defined in JSP for developing the fast web application purpose. A Java developer can use these objects directly in their code. Implicit objects are created by the web container, these objects are called the Java objects that implements the Servlet and JSP API's interfaces. In JSP nine (9) implicit objects are defined these are as follows :

  1. request : An implicit object request, specifies the client request. To access the HTTP request, class of this object implements the HttpServletRequest interface however, javax.servlet.http.HttpServletRequest extends the javax.servlet.ServletRequest interface. Using the request implicit object you can get the request parameters, request attributes, header information and many more related to HTTP request. Container passes request object to the _jspService()method as a parameter. Scope this object is specified for a request made by the client.
     
  2. response : An implicit object response, specifies the response to be given to the client. To provide the HTTP response, class of this object implements the HttpServletResponse interface however, javax.servlet.http.HttpServletResponse extends the javax.servlet.ServletResponse interface. Using the response object you can manipulate the response to be given to the client such as contentType of response can be set, cookie can be added to response, the response can be redirected.
     
  3. out : An implicit object out, specifies the output content of the respons. Using this implicit object you can access the output stream of servlet. Scope of this object is specified for a page. This object is an instance of javax.servlet.jsp.JspWriter class.
     
  4. session : An implicit object session, specifies the client specific conversation. Class of this object implements the javax.servlet.http.HttpSession interface. Using this object you can established a seesion, state for a single user and many more. This object has the session scope.
     
  5. application : An implicit object application, specifies the information of web application in which it runs. Class of this object implements the javax.servlet.ServletContext interface. Scope of this implicit object is specified for the whole application.
     
  6. exception : An implicit object exception, specifies the occurred exception. In a JSP page when an exception is occurred control is passed to the JSP error page. This object is an instance of java.lang.Throwable class. Scope of this object is specified for a page.
     
  7. config : An implicit object config, specifies the configuration of JSP page's servlet. This object is used to get the available initialization parameter. Class of this object implements the javax.servlet.ServletConfig interface. Scope of this object is specified for the JSP page.
     
  8. page : An implicit object page, specifies the current JSP page. This object is an instance of java.lang.Object class. page implicit object consumes large memory.
     
  9. pageContext : An implicit object pageContext, specifies the context information. This implicit object is an instance of the javax.servlet.jsp.PageContext abstract class. Using this method you can set and get attributes in different scopes and can transfer request to other resources.