JSP - SPLessons

JSP Implicit Objects

Home > Lesson > Chapter 11
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

JSP Implicit Objects

JSP Implicit Objects

shape Description

JSP Implicit Objects, JSP has 9 implicit objects made by web container and those implicit objects are available in all JSP pages. Implicit objects can be directly used in scriptlets. JSP Implicit objects can be directly used without declaring.

shape Conceptual figure

Page

Page is an implict object. Page object is used for referencing auto generated Servlet class. For using page object type casting must be done.

Out

Out object is used for writing data into buffer. Out object belongs to JspWriter. Out object is mostly used with JspExpression to invoke the class.

Request

Request is an implict object of HttpServletRequest. Request object is used for requesting parameters, character encoding, header type, content, information, remote address, server name, server port.

Exception

Exception object is typically utilized for producing a suitable reaction to the mistake condition.

Page Content

The pageContext is utilized to indicate the whole JSP page. PageContext object is an instance of a javax.servlet.jsp.PageContext.PageContent object is used as a way to get to data about the page while concealing a large portion of the execution points of interest.

Config

This object is utilized to get introduction parameter for a specific JSP page and it is made to every single JSP page.

Response

Response object is used for providing methods to the HTML header. Responce object is implict of  javax.servlet.http.HttpServletRequest.

Session

Session object is associated with HTTP Request. Session object is for set, get or remove attribute or to get session information.

Application

It is an instance of a javax.servlet.ServletContext. Application object is created by web container. Application object is also used to get RequestDispatcher object.

List of JSP Implicit Objects

shape Table

Object Package Scope
application Javax.servlet.ServletContext Web application scope
exeption Javax.servlet.Throwable page scope
page This(current class object reference) page scope
config Javax.servlet.ServletConfig Page Scope
out javax.servlet.jsp.jspwriter page scope
pagecontext java.servlet.jsp.PageContext page scope
session javax.servlet.http.HttpSession Session scope
request javax.servlet.http.HttpServletRequest Request scope
response javax.servlet.hht.HttpServletRespons Response scope

JSP Implicit Object: Out

shape Description

JSP Implicit Objects - While writing the JSP program, it is not possible to remember the class names of the implicit objects because the change is based on the server utilized. The implicit out is an object of JSP container, which supplies java class that extends from javax.servlet.jsp.JspWriter, and not directly from the javax.servlet.jsp.JspWriter class.

shape Example

Following is an example. welcome.jsp [java] <html> <body> <% out.println("Hi john, welcome to Splessons"); %> </body> </html> [/java] Output Here out.println is used to display the data.

Summary

shape Key Points

  • JSP Implicit Objects can be also called as pre defined variables.
  • Implict objects are Java objects and they are placed in Jsp Container.