• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » JSP » Elements » Exploring Implicit Objects
Next →
← Prev

Exploring Implicit Objects

By Dinesh Thakur

A JSP program can have two types of objects.

• Explicit objects

• Implicit objects

1. Explicit Objects

Explicit objects are those which are created by the programmer manually.

1
Ex:<% <a href="https://ecomputernotes.com/java/what-is-java/what-is-java-explain-basic-features-of-java-language" data-internallinksmanager029f6b8e52c="16">java</a>.util.Date d=new <a href="https://ecomputernotes.com/java/what-is-java/what-is-java-explain-basic-features-of-java-language" data-internallinksmanager029f6b8e52c="16">java</a>.util.Date ();%>

In JSP, implicit objects are important because they contain high degree of functionality. They are used in a JSP page to make it dynamic. The JSP container automatically initiates these objects while writing the script content in the scriptlet and expression tags. So these objects are called implicit objects. These are predefined and accessible to all JSP pages. Sun Microsystems has given JSP specification with some object reference names so that vendor or server developer must have to initialize these objects in the _jspService () method.

Features of Implicit Objects

• Programmer need not declare explicitly these implicit objects.

• Available to all JSP pages, so no need to import them into JSP page.

• Allow developers to access the services and resources provided by the web container.

Types of Implicit Objects

During page compilation the JSP engine initiates nine implicit objects in the _jspService () method. These JSP implicit objects are:

• Request object: It is of type javax.servlet.HttpServletRequestinterface. Its use is similar Servlet. When client makes a request then request objects are passed to _jspService (-,-) as parameters. Its visibility scope is specific to each request.

• Response object: After _jspService (-,- )is executed, response object carries response to browser window. The response object is of type javax.servlet. http.HttpServletResponsewterface. Its visibility scope is specific to each response.

• Out object: The out implicit object provides access to the Servlet’s output stream. This object is a subtype of javax.servlet.jsp.JspWriter (Abstract Class). The out object is used to write the text data. Its visibility scope is specific to each JSP page.

• Page object: It is of type java.lang.Object. it is rarely used in a document because variable type is object. It cannot be used directly to call the servlet methods. Its visibility scope is specific to each JSP page.

• Page Context object: It represents the context of the current JSP page. This object isjavax.servlet.jsp.PageContextinterface type and its visibility scope is specific to each JSP page.

• Application object: It is of javax.servlet.ServletContextinterface type. Its visibility scope is global in the web application.

• Session object: It is of javax.servlet.http.HttpSessioninterface type. Visibilty scope is specific to each browser window. It is declared if the value of the session attribute in a page directive is true.

• Config object: This config object specifies the configuration of the parameters passed to a JSP page. It is of javax.servlet. ServletConfiginterface type. To demonstrate this we need to associate a Servlet file by using <jsp-file> element.

• Exception object: It is of java .lang. Throwable (class) type. Visible only in JSP error pages that have the ErrorPage attribute set to ‘true’ with page directives.

All implicit objects are available within scriptlet and expression tags only but not available within declaration tag. All implicit objects are the objects of underlying Servlet Container supplied by Java classes but we never bother about these classes because these classes’ name will change based on the container/server that we used.

Example: In Tomcat server, request object class name is org.

apache.catnlina.connector.ReqestFacade.

Working with implicit objects

Here, we have given one type of example; later you can find other types of examples.

Deployment directory structure

Request url: https://ecomputernotes.com:8081/Implijsp/first.html

First.html

1
2
3
4
5
6
7
<html>
 <body>
 <form action=“first.jsp”>
  name: <input type=“text” name= “t1”>
  <input type= “submit” value= “enter”/>
 </form>
</html>

first.jsp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
  <b> Implicit objects utilization </b> <hr>
  <body>
   Mr/Ms: <b> <font size=“5” color=“green”> <%=request.getParameter (“t1”)) %> </font> welcome to interface software: </b> <br> <br>
   <table border=“l” color=“blue”>
   <tr> <td> request object class name is </td>
    <td> <i> <%=request.getClass () %> </i> </td> </tr>
  <tr> <td> response object class name is </td>
    <td> <i> <%=response.getClass () %> </i> </td> </tr>
  <tr> <td> session object class name is </td>
   <td> <i> <%=session.getClass () %> </i> </td> </tr>
  <tr> <td> application object class name is </td>
   <td> <i> <%=application.getClass ( ) %> </i> </td> </tr>
  <tr> <td> pageContext object class name is </td>
   <td> <i> <%=pageContext.getClass () %> </i> </td> </tr>
  <tr> <td> page object class name is </td>
   <td> <i> <%=page.getClass () %> </i> </td> </tr>
  <tr> <td> exception object is not visible inside normal page it visible inside only in error page </td>
  <td> <%--<%=exception.getClass () %>--%> </td> </tr>
 <tr> <td> config object class name is </td>
  <td> <i> <%=config.getClass () %> </i> </td> </tr>
 <tr> <td> out object class name is </td>
  <td> <i> <%=out.getClass () %> </i> </td> </tr>
 <tr><td> <b> other method call on request object </b> </td> </tr>
 <tr> <td> request header </td>
  <td> <%=request.getHeader (“user-agent”) %> </td> </tr>
 <tr> <td> request method </td>
  <td> <%=request.getMethod () %> </td> </tr>
 <tr> <td> request URL </td>
  <td> <%=request.getRequestURL () %> </td> </tr>
 <tr> <td> request <a href="https://ecomputernotes.com/computernetworkingnotes/computer-network/protocol" data-internallinksmanager029f6b8e52c="15">protocol</a> </td>
  <td> <%=request.getProtocol () %> </td> </tr>
</table></html>

You’ll also like:

  1. Adding the Contents of Two objects by passing objects as parameter.
  2. How to Creating Objects and Allocate Memory for Objects in c++
  3. Implicit Type Conversion in Java Example
  4. What is Classes Objects
  5. Objects and Classes in Java
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

Java Server Pages

Java Server Pages

  • JSP - Home
  • JSP - Advantages
  • JSP - Architecture
  • JSP - Life Cycle
  • JSP - Servlet Disadvantages
  • JSP - PrintWriter Vs JspWriter
  • JSP - Session Tracking
  • JSP - Stateless Protocol
  • JSP - Hidden Form Fields
  • JSP - Program Structure
  • JSP - Bill Discount Program
  • JSP - Scripting Elements
  • JSP - fn:length()
  • JSP - fn:split()
  • JSP - fmt formatNumber Tag
  • JSP - Servlet Communication
  • JSP - fn:replace()
  • JSP - fmt:parseNumber Tag
  • JSP - fmt:parseDate Tag
  • JSP - fn:substring()

Other Links

  • JSP - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW