SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Implicit Objects
Advance Java
(2160707)
Prepared By::
Metaliya Darshit (130110107020)
INTRODUCTION
JSP Implicit Objects are the Java objects that the JSP Container
makes available to developers in each page and developer can
call them directly without being explicitly declared.
JSP Implicit Objects are also called pre-defined variables.
Object Description
Request This is the HttpServletRequest object associated with the request.
response
This is the HttpServletResponse object associated with the response to the
client.
out This is the PrintWriter object used to send output to the client.
session This is the HttpSession object associated with the request.
application This is the ServletContext object associated with application context.
config This is the ServletConfig object associated with the page.
pageContext
This encapsulates use of server-specific features like higher performance
JspWriters.
page
This is simply a synonym for this, and is used to call the methods defined
by the translated servlet class.
Exception
The Exception object allows the exception data to be accessed by
designated JSP.
REQUEST OBJECT
Implicit object of type HttpServletRequest i.e. created for each
jsp request by the web container.
Use:
To get request information such as parameter, header
information, remote address, server name, server port,
content type, character encoding
To set, get and remove attributes from the jsp request
scope.
REQUEST OBJECT
Index.html
<form action="welcome.jsp">
<input type="text" name="uname">
<input type="submit" value="go"><br/>
</form>
Newjsp.jsp
<%
String name=request.getParameter("uname");
out.print("welcome "+name);
%>
RESPONSE OBJECT
Implicit object of type HttpServletResponse. The instance of
HttpServletResponse is created by the web container for each
jsp request.
Defines the interfaces that deal with creating new HTTP
headers. Through this object the JSP programmer can add new
cookies or date stamps, HTTP status codes etc.
Use:
To add or manipulate response such as redirect response
to another resource, send error etc.
Newjsp.jsp
<%
response.sendRedirect("http://www.google.com");
OUT OBJECT
Instance of a javax.servlet.jsp.JspWriter object and is used to
send content in a response.
Use:
For writing any data to the buffer
displaying dynamic data
The java way to display text on the webpage
Newjsp.jsp
<% out.print("Today is:"+java.util.Calendar.getInstance().getTime());
%>
SESSION OBJECT
implicit object of type HttpSession.
Use:
to set, get or remove attribute or to get session
information.
to track client session between client requests
SESSION OBJECT
Index.html
<form action="welcome.jsp">
<input type="text" name="uname">
<input type="submit" value="go"><br/>
</form>
Newjsp.jsp
<%
String name=request.getParameter("uname");
out.print("Welcome "+name);
session.setAttribute("user",name);
%><a href="second.jsp">second jsp page</a>
SESSION OBJECT
second.jsp
<%
String name=(String)session.getAttribute("user");
out.print("Hello "+name);
%>
APPLICATION OBJECT
Implicit object of type ServletContext.
Instance of ServletContext is created only once by the web
container when application or project is deployed on the server.
Use
To get initialization parameter from configuaration file
(web.xml).
To get, set or remove attribute from the application scope.
APPLICATION OBJECT
Newjsp.jsp
<%
out.print("Welcome "+request.getParameter("uname"));
String driver=application.getInitParameter("dname");
out.print("driver name is="+driver);
%>
CONFIG OBJECT
Implicit object of type ServletConfig.
Use:
To get initialization parameter for a particular JSP page
Allows the JSP programmer access to the Servlet or JSP
engine initialization parameters such as the paths or file
locations etc.
CONFIG OBJECT
PAGECONTEXT OBJECT
Implicit object of type PageContext class
Intended as a means to access information about the page
while avoiding most of the implementation details.
Use:
To set, get or remove attribute from one of the following
scopes:
page
request
session
Application
In JSP, page scope is the default scope.
PAGECONTEXT OBJECT
Newjsp.jsp
<%
String name=request.getParameter("uname");
out.print("Welcome "+name);
pageContext.setAttribute("user",name,PageContext.SESSION_SC
OPE); %>
<a href="second.jsp">second jsp page</a>
PAGECONTEXT OBJECT
second.jsp
<%
String name=(String)pageContext.getAttribute("user",PageContext.SES
SION_SCOPE);
out.print("Hello "+name);
%>
PAGE OBJECT
An actual reference to the instance of the page.
It can be thought of as an object that represents the entire JSP
page.
implicit object of type java.lang.Throwable class.
The exception object is a wrapper containing the exception
thrown from the previous page. It is typically used to generate
an appropriate response to the error condition.
EXCEPTION OBJECT
implicit object of type java.lang.Throwable class.
A wrapper containing the exception thrown from the previous
page.
Use:
To generate an appropriate response to the error
condition.
Implicit objects advance Java

More Related Content

What's hot (20)

PPTX
Jdbc ppt
sandeep54552
 
PPTX
Servlets
Akshay Ballarpure
 
PPS
Jdbc architecture and driver types ppt
kamal kotecha
 
PPTX
Apache tomcat
Shashwat Shriparv
 
PPTX
Event In JavaScript
ShahDhruv21
 
PPT
Advanced java
NA
 
PPTX
An Introduction To REST API
Aniruddh Bhilvare
 
PPTX
Broadcast Receiver
nationalmobileapps
 
PPT
Intro to web services
Neil Ghosh
 
PDF
Android notification
Krazy Koder
 
PPTX
Types of Drivers in JDBC
Hemant Sharma
 
PPTX
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
Aaqib Hussain
 
PPTX
Http request and http response
Nuha Noor
 
PPT
Asp.net.
Naveen Sihag
 
PPTX
JDBC Driver Types
Rahul Sharma
 
PPTX
An Overview of Web Services: SOAP and REST
Ram Awadh Prasad, PMP
 
PDF
Spring Framework - Core
Dzmitry Naskou
 
PPTX
Database in Android
MaryadelMar85
 
Jdbc ppt
sandeep54552
 
Jdbc architecture and driver types ppt
kamal kotecha
 
Apache tomcat
Shashwat Shriparv
 
Event In JavaScript
ShahDhruv21
 
Advanced java
NA
 
An Introduction To REST API
Aniruddh Bhilvare
 
Broadcast Receiver
nationalmobileapps
 
Intro to web services
Neil Ghosh
 
Android notification
Krazy Koder
 
Types of Drivers in JDBC
Hemant Sharma
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
Aaqib Hussain
 
Http request and http response
Nuha Noor
 
Asp.net.
Naveen Sihag
 
JDBC Driver Types
Rahul Sharma
 
An Overview of Web Services: SOAP and REST
Ram Awadh Prasad, PMP
 
Spring Framework - Core
Dzmitry Naskou
 
Database in Android
MaryadelMar85
 

Viewers also liked (8)

PPT
Active x
andrew20827
 
PPS
Jsp chapter 1
kamal kotecha
 
PPT
Active x control
Amandeep Kaur
 
PPT
Active server pages
mcatahir947
 
PPS
Jsp element
kamal kotecha
 
PPTX
Introduction ASP
FaTin GhaZmi
 
PPT
Active Server Page(ASP)
Keshab Nath
 
PPTX
Client side scripting and server side scripting
baabtra.com - No. 1 supplier of quality freshers
 
Active x
andrew20827
 
Jsp chapter 1
kamal kotecha
 
Active x control
Amandeep Kaur
 
Active server pages
mcatahir947
 
Jsp element
kamal kotecha
 
Introduction ASP
FaTin GhaZmi
 
Active Server Page(ASP)
Keshab Nath
 
Client side scripting and server side scripting
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Similar to Implicit objects advance Java (20)

PPTX
Jsp session implicit object
chauhankapil
 
PDF
J2EE jsp_03
Biswabrata Banerjee
 
PPTX
JSP.pptx programming guide for beginners and experts
rani marri
 
PPTX
4. jsp
AnusAhmad
 
PPT
Web&java. jsp
Asya Dudnik
 
PPT
Web&java. jsp
Asya Dudnik
 
PPTX
Jsp session 3
Anuj Singh Rajput
 
PPTX
JSP - Java Server Page
Vipin Yadav
 
DOC
Jsp advance part i
sameersaxena90
 
PDF
Lap trinh web [Slide jsp]
Tri Nguyen
 
PPTX
Introduction to JSP.pptx
ManishaPatil932723
 
PPTX
Introduction to JSP
Geethu Mohan
 
PDF
JAVA EE DEVELOPMENT (JSP and Servlets)
Talha Ocakçı
 
PPTX
Advance java session 11
Smita B Kumar
 
PPTX
ADP - Chapter 5 Exploring JavaServer Pages Technology
Riza Nurman
 
PPT
Atul & shubha goswami jsp
Atul Giri
 
PDF
J2EE jsp_01
Biswabrata Banerjee
 
PDF
JSP Components and Directives.pdf
Arumugam90
 
PPTX
Request dispacther interface ppt
Taha Malampatti
 
Jsp session implicit object
chauhankapil
 
J2EE jsp_03
Biswabrata Banerjee
 
JSP.pptx programming guide for beginners and experts
rani marri
 
4. jsp
AnusAhmad
 
Web&java. jsp
Asya Dudnik
 
Web&java. jsp
Asya Dudnik
 
Jsp session 3
Anuj Singh Rajput
 
JSP - Java Server Page
Vipin Yadav
 
Jsp advance part i
sameersaxena90
 
Lap trinh web [Slide jsp]
Tri Nguyen
 
Introduction to JSP.pptx
ManishaPatil932723
 
Introduction to JSP
Geethu Mohan
 
JAVA EE DEVELOPMENT (JSP and Servlets)
Talha Ocakçı
 
Advance java session 11
Smita B Kumar
 
ADP - Chapter 5 Exploring JavaServer Pages Technology
Riza Nurman
 
Atul & shubha goswami jsp
Atul Giri
 
J2EE jsp_01
Biswabrata Banerjee
 
JSP Components and Directives.pdf
Arumugam90
 
Request dispacther interface ppt
Taha Malampatti
 
Ad

Recently uploaded (20)

PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Hashing Introduction , hash functions and techniques
sailajam21
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Thermal runway and thermal stability.pptx
godow93766
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 

Implicit objects advance Java

  • 1. Implicit Objects Advance Java (2160707) Prepared By:: Metaliya Darshit (130110107020)
  • 2. INTRODUCTION JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer can call them directly without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.
  • 3. Object Description Request This is the HttpServletRequest object associated with the request. response This is the HttpServletResponse object associated with the response to the client. out This is the PrintWriter object used to send output to the client. session This is the HttpSession object associated with the request. application This is the ServletContext object associated with application context. config This is the ServletConfig object associated with the page. pageContext This encapsulates use of server-specific features like higher performance JspWriters. page This is simply a synonym for this, and is used to call the methods defined by the translated servlet class. Exception The Exception object allows the exception data to be accessed by designated JSP.
  • 4. REQUEST OBJECT Implicit object of type HttpServletRequest i.e. created for each jsp request by the web container. Use: To get request information such as parameter, header information, remote address, server name, server port, content type, character encoding To set, get and remove attributes from the jsp request scope.
  • 5. REQUEST OBJECT Index.html <form action="welcome.jsp"> <input type="text" name="uname"> <input type="submit" value="go"><br/> </form> Newjsp.jsp <% String name=request.getParameter("uname"); out.print("welcome "+name); %>
  • 6. RESPONSE OBJECT Implicit object of type HttpServletResponse. The instance of HttpServletResponse is created by the web container for each jsp request. Defines the interfaces that deal with creating new HTTP headers. Through this object the JSP programmer can add new cookies or date stamps, HTTP status codes etc. Use: To add or manipulate response such as redirect response to another resource, send error etc. Newjsp.jsp <% response.sendRedirect("http://www.google.com");
  • 7. OUT OBJECT Instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response. Use: For writing any data to the buffer displaying dynamic data The java way to display text on the webpage Newjsp.jsp <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %>
  • 8. SESSION OBJECT implicit object of type HttpSession. Use: to set, get or remove attribute or to get session information. to track client session between client requests
  • 9. SESSION OBJECT Index.html <form action="welcome.jsp"> <input type="text" name="uname"> <input type="submit" value="go"><br/> </form> Newjsp.jsp <% String name=request.getParameter("uname"); out.print("Welcome "+name); session.setAttribute("user",name); %><a href="second.jsp">second jsp page</a>
  • 11. APPLICATION OBJECT Implicit object of type ServletContext. Instance of ServletContext is created only once by the web container when application or project is deployed on the server. Use To get initialization parameter from configuaration file (web.xml). To get, set or remove attribute from the application scope.
  • 12. APPLICATION OBJECT Newjsp.jsp <% out.print("Welcome "+request.getParameter("uname")); String driver=application.getInitParameter("dname"); out.print("driver name is="+driver); %>
  • 13. CONFIG OBJECT Implicit object of type ServletConfig. Use: To get initialization parameter for a particular JSP page Allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file locations etc.
  • 15. PAGECONTEXT OBJECT Implicit object of type PageContext class Intended as a means to access information about the page while avoiding most of the implementation details. Use: To set, get or remove attribute from one of the following scopes: page request session Application In JSP, page scope is the default scope.
  • 16. PAGECONTEXT OBJECT Newjsp.jsp <% String name=request.getParameter("uname"); out.print("Welcome "+name); pageContext.setAttribute("user",name,PageContext.SESSION_SC OPE); %> <a href="second.jsp">second jsp page</a>
  • 18. PAGE OBJECT An actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page. implicit object of type java.lang.Throwable class. The exception object is a wrapper containing the exception thrown from the previous page. It is typically used to generate an appropriate response to the error condition.
  • 19. EXCEPTION OBJECT implicit object of type java.lang.Throwable class. A wrapper containing the exception thrown from the previous page. Use: To generate an appropriate response to the error condition.