SlideShare a Scribd company logo
1 of 19
Implicit Objects
Agenda
• Understanding built In Objects
• Request, response
• Out
• session
• exception
• page and application scope
Implicit Object
• A JSP page has access to certain implicit objects that are always
available, without being declared first
• Created by container
• Corresponds to classes defined in Servlet
Implicit Object
- Provide access to many servlet capabilities within a JSP
- Four scopes
• Application scope
- Objects owned by the container application
- Any servlet or JSP can manipulate these objects
• Session scope
- Objects exist for duration of client’s browsing session
- Objects go out of scope when client terminates session or when
session timeout occurs
• Request scope
- Objects exist for duration of client request
- Objects go out of scope after response sent to client
• Page scope
- Objects that exist only in page in which they are defined
- Each page has its own instance of these objects
Implicit Object
Implicit object Description
Application Scope
application This javax.servlet.ServletContext object represents the container in which the JSP
executes.
Page Scope
config This javax.servlet.ServletConfig object represents the JSP configuration options. As
with servlets, configuration options can be specified in a Web application descriptor.
exception This java.lang.Throwable object represents the exception that is passed to the JSP error
page. This object is available only in a JSP error page.
out This javax.servlet.jsp.JspWriter object writes text as part of the response to a request.
This object is used implicitly with JSP expressions and actions that insert string content in a
response.
page This java.lang.Object object represents the this reference for the current JSP instance.
pageContext This javax.servlet.jsp.PageContext object hides the implementation details of the
underlying servlet and JSP container and provides JSP programmers with access to the implicit
objects discussed in this table.
response This object represents the response to the client and is normally an instance of a class that
implements HttpServletResponse (package javax.servlet.http). If a protocol other
than HTTP is used, this object is an instance of a class that implements
javax.servlet.ServletResponse.
Request Scope
request This object represents the client request. The object normally is an instance of a class that
implements HttpServletRequest (package javax.servlet.http). If a protocol other
than HTTP is used, this object is an instance of a subclass of javax.servlet.Servlet-
Request.
Session Scope
session This javax.servlet.http.HttpSession object represents the client session information
if such a session has been created. This object is available only in pages that participate in a
session.
Implicit Object and their classes
• request (HttpServletRequest)
• response (HttpServletRepsonse)
• session (HttpSession)
• application(ServletContext)
• out (of type JspWriter)
• config (ServletConfig)
• pageContext(this)
Creating an exception with an error page
• Determine the exception thrown
• In each of your JSP, include the name of the error page
- <%@ page errorPage="errorpage.jsp" %>
• Develop an error page, it should include
- <%@ page isErrorPage="true" %>
• In the error page, use the exception reference to display exception
information
<%= exception.toString() %>
About Exception Object
• Instance of java.lang.Throwable
• It is available in those pages where isError page directive is set to
true
• Important methods
- public String getlocalizedMessage()
- public String getMessage()
- public void printStackTrace()
- public void printStackTrace(PrintStream ps)
- public void printStackTrace(PrintWriter pw)
Session Object
• This denotes the data associated with a specific session of user.
• The class or the interface name of the object Session is
http.HttpSession.
• The previous two objects, request and response, are used to pass
information from web browser to server and from server to web
browser respectively.
• The Session Object provides the connection or association between
the client and the server.
• The main use of Session Objects is for maintaining states hen there
are multiple page requests.
Session Object
• It is an instanceof javax.servlet.http.HttpSession
• getAttributes returns the bounded object or null
• getAttributes return Enumeration of String Objects containing names
of all Object bounded to the session
• getCreationTime returns the time in millseconds when the session
• isNew() returns true if the server has created a session that hasn’t been
accessed by the client
• getId() returns String Object containing a unique identifier for his
session
• Invalidate() invalidates the session and unbinds any object bound to it
Request Object
• The request object is an instance of a
javax.servlet.http.HttpServletRequest object. Each time a client
requests a page the JSP engine creates a new object to represent
that request.
• The request object provides methods to get HTTP header
information including form data, cookies, HTTP methods etc.
Request Object methods
• public Object getAttribute(String name)
• getAttributeNames() returns an Enumeration containing the attribute names
available to the invoking ServletRequest object:
• public java.util.Enumeration getAttributeNames()
• getAuthType() returns the name of the authentication scheme used in the
request or null if no authentication scheme was used. It returns one of the
constants BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, or
DIGEST_AUTH, or it returns null if the request wasn't authenticated:
• public String getAuthType()
• getCharacterEncoding() returns a String object containing the character
encoding used in the body of the request or null if there's no encoding:
• public String getCharacterEncoding()
Request Object methods
• public Object getAttribute(String name)
• getAttributeNames() returns an Enumeration containing the attribute names
available to the invoking ServletRequest object:
• public java.util.Enumeration getAttributeNames()
• getAuthType() returns the name of the authentication scheme used in the
request or null if no authentication scheme was used. It returns one of the
constants BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, or
DIGEST_AUTH, or it returns null if the request wasn't authenticated:
• public String getAuthType()
• getCharacterEncoding() returns a String object containing the character
encoding used in the body of the request or null if there's no encoding:
• public String getCharacterEncoding()
Response Object
• The response object is an instance of a
javax.servlet.http.HttpServletResponse object. Just as the server
creates the request object, it also creates an object to represent the
response to the client.
• The response object also 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.
out Object
• The out implicit object is an instance of a javax.servlet.jsp.JspWriter
object and is used to send content in a response.
• The initial JspWriter object is instantiated differently depending on
whether the page is buffered or not. Buffering can be easily turned off
by using the buffered='false' attribute of the page directive.
• The JspWriter object contains most of the same methods as the
java.io.PrintWriter class. However, JspWriter has some additional
methods designed to deal with buffering. Unlike the PrintWriter object,
JspWriter throws IOExceptions.
application Object
• The application object is direct wrapper around the ServletContext
object for the generated Servlet and in reality an instance of a
javax.servlet.ServletContext object.
• This object is a representation of the JSP page through its entire
lifecycle. This object is created when the JSP page is initialized and will
be removed when the JSP page is removed by the jspDestroy() method.
• By adding an attribute to application, you can ensure that all JSP files
that make up your web application have access to it.
config Object
• The config object is an instantiation of javax.servlet.ServletConfig and
is a direct wrapper around the ServletConfig object for the generated
servlet.
• This object allows the JSP programmer access to the Servlet or JSP
engine initialization parameters such as the paths or file locations etc.
pageContext Object
• The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The
pageContext object is used to represent the entire JSP page.
• This object is intended as a means to access information about the page while
avoiding most of the implementation details.
• This object stores references to the request and response objects for each request.
The application, config, session, and out objects are derived by accessing attributes
of this object.
• The pageContext object also contains information about the directives issued to the
JSP page, including the buffering information, the errorPageURL, and page scope.
• The PageContext class defines several fields, including PAGE_SCOPE,
REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, which
identify the four scopes. It also supports more than 40 methods, about half of which
are inherited from the javax.servlet.jsp. JspContext class
Summary
• Implicit Objects
- page
- request
- session
- application
- response
- out
- cexception

More Related Content

What's hot

Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)Fahad Golra
 
.NET Core, ASP.NET Core Course, Session 14
.NET Core, ASP.NET Core Course, Session 14.NET Core, ASP.NET Core Course, Session 14
.NET Core, ASP.NET Core Course, Session 14aminmesbahi
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Trainingsourabh aggarwal
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...SPTechCon
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13aminmesbahi
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W WO Community
 
Hibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionHibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionEr. Gaurav Kumar
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepGuo Albert
 
Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Sameer Rathoud
 
Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPASubin Sugunan
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsDaniel Ballinger
 
Wcf data services
Wcf data servicesWcf data services
Wcf data servicesEyal Vardi
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its managementVinay Kumar Pulabaigari
 

What's hot (20)

Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
 
.NET Core, ASP.NET Core Course, Session 14
.NET Core, ASP.NET Core Course, Session 14.NET Core, ASP.NET Core Course, Session 14
.NET Core, ASP.NET Core Course, Session 14
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
 
Rest
Rest Rest
Rest
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Training
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
JPA Best Practices
JPA Best PracticesJPA Best Practices
JPA Best Practices
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W
 
Hibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionHibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic Introduction
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)
 
Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPA
 
Deployment
DeploymentDeployment
Deployment
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service Clients
 
Wcf data services
Wcf data servicesWcf data services
Wcf data services
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its management
 

Similar to Advance java session 11

Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsPawanMM
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6PawanMM
 
J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentjoearunraja2
 
Advance java session 18
Advance java session 18Advance java session 18
Advance java session 18Smita B Kumar
 
Implicit Objects &Handling.pptx
Implicit Objects &Handling.pptxImplicit Objects &Handling.pptx
Implicit Objects &Handling.pptxKSuvetha1
 
Core web application development
Core web application developmentCore web application development
Core web application developmentBahaa Farouk
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5PawanMM
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteJava Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteTushar B Kute
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4Ben Abdallah Helmi
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance JavaDarshit Metaliya
 
JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...MathivananP4
 
Enterprise java unit-1_chapter-3
Enterprise java unit-1_chapter-3Enterprise java unit-1_chapter-3
Enterprise java unit-1_chapter-3sandeep54552
 
Integrating Servlets and JSP (The MVC Architecture)
Integrating Servlets and JSP  (The MVC Architecture)Integrating Servlets and JSP  (The MVC Architecture)
Integrating Servlets and JSP (The MVC Architecture)Amit Ranjan
 

Similar to Advance java session 11 (20)

Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6
 
J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environment
 
Advance java session 18
Advance java session 18Advance java session 18
Advance java session 18
 
Servlet
ServletServlet
Servlet
 
Servlets
ServletsServlets
Servlets
 
Implicit Objects &Handling.pptx
Implicit Objects &Handling.pptxImplicit Objects &Handling.pptx
Implicit Objects &Handling.pptx
 
Core web application development
Core web application developmentCore web application development
Core web application development
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5
 
Jsp session 3
Jsp   session 3Jsp   session 3
Jsp session 3
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteJava Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
Servlet11
Servlet11Servlet11
Servlet11
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
 
JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...
 
Chap4 4 1
Chap4 4 1Chap4 4 1
Chap4 4 1
 
Enterprise java unit-1_chapter-3
Enterprise java unit-1_chapter-3Enterprise java unit-1_chapter-3
Enterprise java unit-1_chapter-3
 
Integrating Servlets and JSP (The MVC Architecture)
Integrating Servlets and JSP  (The MVC Architecture)Integrating Servlets and JSP  (The MVC Architecture)
Integrating Servlets and JSP (The MVC Architecture)
 

More from Smita B Kumar

Advance java session 20
Advance java session 20Advance java session 20
Advance java session 20Smita B Kumar
 
Advance java session 19
Advance java session 19Advance java session 19
Advance java session 19Smita B Kumar
 
Advance java session 17
Advance java session 17Advance java session 17
Advance java session 17Smita B Kumar
 
Advance java session 16
Advance java session 16Advance java session 16
Advance java session 16Smita B Kumar
 
Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15Smita B Kumar
 
Advance java session 14
Advance java session 14Advance java session 14
Advance java session 14Smita B Kumar
 
Advance java session 13
Advance java session 13Advance java session 13
Advance java session 13Smita B Kumar
 
Advance java session 12
Advance java session 12Advance java session 12
Advance java session 12Smita B Kumar
 
Advance java session 10
Advance java session 10Advance java session 10
Advance java session 10Smita B Kumar
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9Smita B Kumar
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8Smita B Kumar
 
Advance java session 7
Advance java session 7Advance java session 7
Advance java session 7Smita B Kumar
 
Advance java session 6
Advance java session 6Advance java session 6
Advance java session 6Smita B Kumar
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5Smita B Kumar
 
Advance java session 4
Advance java session 4Advance java session 4
Advance java session 4Smita B Kumar
 
Advance java session 3
Advance java session 3Advance java session 3
Advance java session 3Smita B Kumar
 
Advance java session 2
Advance java session 2Advance java session 2
Advance java session 2Smita B Kumar
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2Smita B Kumar
 

More from Smita B Kumar (19)

Advance java session 20
Advance java session 20Advance java session 20
Advance java session 20
 
Advance java session 19
Advance java session 19Advance java session 19
Advance java session 19
 
Advance java session 17
Advance java session 17Advance java session 17
Advance java session 17
 
Advance java session 16
Advance java session 16Advance java session 16
Advance java session 16
 
Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15
 
Advance java session 14
Advance java session 14Advance java session 14
Advance java session 14
 
Advance java session 13
Advance java session 13Advance java session 13
Advance java session 13
 
Advance java session 12
Advance java session 12Advance java session 12
Advance java session 12
 
Advance java session 10
Advance java session 10Advance java session 10
Advance java session 10
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
 
Advance java session 7
Advance java session 7Advance java session 7
Advance java session 7
 
Advance java session 6
Advance java session 6Advance java session 6
Advance java session 6
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5
 
Advance java session 4
Advance java session 4Advance java session 4
Advance java session 4
 
Advance java session 3
Advance java session 3Advance java session 3
Advance java session 3
 
Advance java session 2
Advance java session 2Advance java session 2
Advance java session 2
 
JEE session 1
JEE session 1JEE session 1
JEE session 1
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2
 

Recently uploaded

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Advance java session 11

  • 2. Agenda • Understanding built In Objects • Request, response • Out • session • exception • page and application scope
  • 3. Implicit Object • A JSP page has access to certain implicit objects that are always available, without being declared first • Created by container • Corresponds to classes defined in Servlet
  • 4. Implicit Object - Provide access to many servlet capabilities within a JSP - Four scopes • Application scope - Objects owned by the container application - Any servlet or JSP can manipulate these objects • Session scope - Objects exist for duration of client’s browsing session - Objects go out of scope when client terminates session or when session timeout occurs • Request scope - Objects exist for duration of client request - Objects go out of scope after response sent to client • Page scope - Objects that exist only in page in which they are defined - Each page has its own instance of these objects
  • 5. Implicit Object Implicit object Description Application Scope application This javax.servlet.ServletContext object represents the container in which the JSP executes. Page Scope config This javax.servlet.ServletConfig object represents the JSP configuration options. As with servlets, configuration options can be specified in a Web application descriptor. exception This java.lang.Throwable object represents the exception that is passed to the JSP error page. This object is available only in a JSP error page. out This javax.servlet.jsp.JspWriter object writes text as part of the response to a request. This object is used implicitly with JSP expressions and actions that insert string content in a response. page This java.lang.Object object represents the this reference for the current JSP instance. pageContext This javax.servlet.jsp.PageContext object hides the implementation details of the underlying servlet and JSP container and provides JSP programmers with access to the implicit objects discussed in this table. response This object represents the response to the client and is normally an instance of a class that implements HttpServletResponse (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a class that implements javax.servlet.ServletResponse. Request Scope request This object represents the client request. The object normally is an instance of a class that implements HttpServletRequest (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a subclass of javax.servlet.Servlet- Request. Session Scope session This javax.servlet.http.HttpSession object represents the client session information if such a session has been created. This object is available only in pages that participate in a session.
  • 6. Implicit Object and their classes • request (HttpServletRequest) • response (HttpServletRepsonse) • session (HttpSession) • application(ServletContext) • out (of type JspWriter) • config (ServletConfig) • pageContext(this)
  • 7. Creating an exception with an error page • Determine the exception thrown • In each of your JSP, include the name of the error page - <%@ page errorPage="errorpage.jsp" %> • Develop an error page, it should include - <%@ page isErrorPage="true" %> • In the error page, use the exception reference to display exception information <%= exception.toString() %>
  • 8. About Exception Object • Instance of java.lang.Throwable • It is available in those pages where isError page directive is set to true • Important methods - public String getlocalizedMessage() - public String getMessage() - public void printStackTrace() - public void printStackTrace(PrintStream ps) - public void printStackTrace(PrintWriter pw)
  • 9. Session Object • This denotes the data associated with a specific session of user. • The class or the interface name of the object Session is http.HttpSession. • The previous two objects, request and response, are used to pass information from web browser to server and from server to web browser respectively. • The Session Object provides the connection or association between the client and the server. • The main use of Session Objects is for maintaining states hen there are multiple page requests.
  • 10. Session Object • It is an instanceof javax.servlet.http.HttpSession • getAttributes returns the bounded object or null • getAttributes return Enumeration of String Objects containing names of all Object bounded to the session • getCreationTime returns the time in millseconds when the session • isNew() returns true if the server has created a session that hasn’t been accessed by the client • getId() returns String Object containing a unique identifier for his session • Invalidate() invalidates the session and unbinds any object bound to it
  • 11. Request Object • The request object is an instance of a javax.servlet.http.HttpServletRequest object. Each time a client requests a page the JSP engine creates a new object to represent that request. • The request object provides methods to get HTTP header information including form data, cookies, HTTP methods etc.
  • 12. Request Object methods • public Object getAttribute(String name) • getAttributeNames() returns an Enumeration containing the attribute names available to the invoking ServletRequest object: • public java.util.Enumeration getAttributeNames() • getAuthType() returns the name of the authentication scheme used in the request or null if no authentication scheme was used. It returns one of the constants BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, or DIGEST_AUTH, or it returns null if the request wasn't authenticated: • public String getAuthType() • getCharacterEncoding() returns a String object containing the character encoding used in the body of the request or null if there's no encoding: • public String getCharacterEncoding()
  • 13. Request Object methods • public Object getAttribute(String name) • getAttributeNames() returns an Enumeration containing the attribute names available to the invoking ServletRequest object: • public java.util.Enumeration getAttributeNames() • getAuthType() returns the name of the authentication scheme used in the request or null if no authentication scheme was used. It returns one of the constants BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, or DIGEST_AUTH, or it returns null if the request wasn't authenticated: • public String getAuthType() • getCharacterEncoding() returns a String object containing the character encoding used in the body of the request or null if there's no encoding: • public String getCharacterEncoding()
  • 14. Response Object • The response object is an instance of a javax.servlet.http.HttpServletResponse object. Just as the server creates the request object, it also creates an object to represent the response to the client. • The response object also 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.
  • 15. out Object • The out implicit object is an instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response. • The initial JspWriter object is instantiated differently depending on whether the page is buffered or not. Buffering can be easily turned off by using the buffered='false' attribute of the page directive. • The JspWriter object contains most of the same methods as the java.io.PrintWriter class. However, JspWriter has some additional methods designed to deal with buffering. Unlike the PrintWriter object, JspWriter throws IOExceptions.
  • 16. application Object • The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object. • This object is a representation of the JSP page through its entire lifecycle. This object is created when the JSP page is initialized and will be removed when the JSP page is removed by the jspDestroy() method. • By adding an attribute to application, you can ensure that all JSP files that make up your web application have access to it.
  • 17. config Object • The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet. • This object allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file locations etc.
  • 18. pageContext Object • The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page. • This object is intended as a means to access information about the page while avoiding most of the implementation details. • This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object. • The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope. • The PageContext class defines several fields, including PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, which identify the four scopes. It also supports more than 40 methods, about half of which are inherited from the javax.servlet.jsp. JspContext class
  • 19. Summary • Implicit Objects - page - request - session - application - response - out - cexception