EXPERIMENT ASSESSMENT
ACADEMIC YEAR 2025-26
Course: Full Stack Java Programming Lab
Course code: 2173611
Year: SE SEM: III
Experiment No. 6
AIM: Program on Implicit and Explicit objects in JSP
Name: Rohit Komal Khanolkar
Roll Number: 11
Date of Performance:
Date of Submission:
Evaluation
Performance Indicator Max. Marks Marks Obtained
Performance 5
Understanding 5
Journal work and timely submission. 10
Total 20
Performance Indicator Exceed Expectations (EE) Meet Expectations (ME) Below Expectations (BE)
Performance 5 3 2
Understanding 5 3 2
Journal work and timely
10 8 4
submission.
Checked by
Name of Faculty : Mr.Yogesh Pingle
1
Aim - Program on Implicit and Explicit objects in JSP
Theory:
JSP which stands for Java Server Pages, is a server-side technology used to create dynamic
web pages. It allows developers to embed Java code within HTML pages using special JSP
tags, enabling the generation of dynamic content based on user requests and other factors.
• Dynamic Web Pages:
JSP is designed to build dynamic web pages, meaning the content that users see can
change based on various factors like user input, database information, or time.
• Embedded Java Code:
JSP allows developers to write Java code directly within HTML pages using JSP tags.
This code is executed on the server, and the resulting output is sent to the client's
browser as HTML.
• Part of Java EE:
JSP is a core component of the Java EE (Enterprise Edition) platform, which provides
a comprehensive set of technologies for building enterprise-level web applications.
• Relationship to Servlets:
JSP can be seen as an extension of Java servlets. While servlets are Java classes, JSP
provides a more convenient way to create dynamic web pages by embedding Java
code within HTML-like syntax.
• JSP Compiler:
JSP pages are translated into Java servlets by a JSP compiler. This compiled servlet is
then executed by the web server to generate the dynamic content.
• Example:
A simple JSP page might include Java code to display the current date and time, or to
retrieve and display data from a database.
Components of a Java Server Page
• Directives
• Actions
• Implicit Objects
• JSP Scripting
Directives :
<%@ page language = “java” %>
The attributes of page Directive:
<%@ include file= “relativeURLSpec” %>
<%@ taglib uri= “taglibraryURI” prefix = “tagprefix” %>
Implicit Objects :
Total 9 implicit objects which are as follows:
1. request: This is the object of HttpServletRequest class associated with the
request.
2. response: This is the object of HttpServletResponse class associated with
the response to the client.
3. config: This is the object of ServletConfig class associated with the page.
4. application: This is the object of ServletContext class associated with the
application context.
5. session: This is the object of HttpSession class associated with the
request.
6. page context: This is the object of PageContext class that encapsulates the
use of serverspecific features. This object can be used to find, get or
remove an attribute.
7. page object: The manner we use the keyword this for current object, page
object is used to refer to the current translated servlet class.
8. exception: The exception object represents all errors and exceptions
which is accessed by the respective jsp. The exception implicit object is
of type java.lang.Throwable.
9. out: This is the PrintWriter object where methods like print and println
help for displaying the content to the client.
The JSP file will compile as follows:
Step 1: Write first JSP program as follows:
<html>
<head><title>First Program</title></head>
<body>
<h1> Output of JSP file </h1>
<% out.println(“Hello world”); %>
</body>
</html>
Save “First.jsp” file in C:\apache-tomcat-9.0.106-windows-x64\apache-
tomcat9.0.106\webapps\Sample folder and open browser and type url as
http://127.0.0.1:8080/Sample/First.jsp
Example :
<%@page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF8" %>
<%@ page import="java.util.Date" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Implicit and Explicit Objects</title>
</head>
<body>
<h2>Implicit Example</h2>
<p>Request Method : <%= request.getMethod()%></p>
<p>Context Path : <%= request.getContextPath()%></p>
<p>Session ID : <%= session.getId()%></p>
<p>Server Info : <%= application.getServerInfo()%></p>
<p>Output using 'out.println' :<% out.println("Hello!this is the the an
object");%></p>
<h2>Explicit Example</h2>
<% Date d = new Date();
String name = "Rohit";%>
<p>Current Date and Time : <%=d %></p>
<p>Explicitly Created Variable : <%=name %></p>
</body>
</html>
Output :