SlideShare a Scribd company logo
Advanced java+JDBC+Servlet
JDBC (Java DataBase Connectivity)
There are four types of JDBC drivers:
1. JDBC-ODBC Bridge Driver
2. Native Driver
3. Network Protocol Driver
4. Thin Driver
1) JDBC-ODBC bridge driver
The JDBC-ODBC bridge driver uses ODBC driver to connect to the database. The
JDBC-ODBC bridge driver converts JDBC method calls into the ODBC function calls.
This is now discouraged because of thin driver.
Advantages
1. easy to use.
2. can be easily connected to any database.
Disadvantages
1. Performance degraded because JDBC method call is converted into the ODBC function
calls.
2. The ODBC driver needs to be installed on the client machine.
2. Native-API driver
The Native API driver uses the client-side libraries of the database. The driver converts
JDBC method calls into native calls of the database API. It is not written entirely in java.
Advantages
1. performance upgraded than JDBC-ODBC bridge driver.
Disadvantages
1. The Native driver needs to be installed on the each client machine.
2. The Vendor client library needs to be installed on client machine.
3) Network Protocol driver
The Network Protocol driver uses middleware (application server) that converts JDBC calls
directly or indirectly into the vendor-specific database protocol. It is fully written in java.
Advantages
1. No client side library is required because of application server that can perform many
tasks like auditing, load balancing, logging etc..
Disadvantages
1. Network support is required on client machine.
2. Requires database-specific coding to be done in the middle tier.
3. Maintenance of Network Protocol driver becomes costly because it requires database-
specific coding to be done in the middle tier.
4) Thin driver
The thin driver converts JDBC calls directly into the vendor-specific database protocol. That
is why it is known as thin driver. It is fully written in Java language.
Advantages
1. Better performance than all other drivers.
2. No software is required at client side or server side.
Disadvantages
1. Drivers depend on the Database.
Java Database Connectivity with 5 Steps
1. Register the Driver class
2. Create connection
3. Create statement
4. Execute queries
5. Close connection
Servlet
1. Servlet is a technology which is used to create a web application.
2. Servlet is an API that provides many interfaces and classes including documentation.
3. Servlet is an interface that must be implemented for creating any Servlet.
4. Servlet is a class that extends the capabilities of the servers and responds to the incoming
requests. It can respond to any requests.
5. Servlet is a web component that is deployed on the server to create a dynamic web page.
Advantages of Servlet
1. Better performance: because it creates a thread for each request, not process.
2. Portability: because it uses Java language.
3. Robust: JVM manages Servlets, so we don't need to worry about the memory leak,
garbage collection, etc.
4. Secure: because it uses java language.
Servlet Life Cycle
Steps for Servlet execution
1. Servlet class is loaded.
2. Servlet instance is created.
3. init method is invoked.
4. service method is invoked.
5. destroy method is invoked.
HttpServlet Class
The HttpServlet class extends the GenericServlet class and implements Serializable
interface. It provides http specific methods such as doGet, doPost, etc.
Methods of HttpServlet class
There are many methods in HttpServlet class. They are as follows:
1. public void service(ServletRequest req,ServletResponse res)
dispatches the request to the protected service method by converting the request and
response object into http type.
2. protected void service(HttpServletRequest req, HttpServletResponse res)
receives the request from the service method, and dispatches the request to the
method depending on the incoming http request type.
3. protected void doGet(HttpServletRequest req, HttpServletResponse res)
handles the GET request. It is invoked by the web container.
4. protected void doPost(HttpServletRequest req, HttpServletResponse res)
handles the POST request. It is invoked by the web container.
Apache Tomcat Server
1. Apache Tomcat is an open source web server that is developed by Apache software
foundation. It basically make our Java Web applications to run on host and server based
system and it is configured on local host port 8080.
2. Apache Tomcat is used to deploy your Java Servlets and JSPs. So in your Java
project you can build your WAR (short for Web ARchive) file, and just drop it in the
deploy directory in Tomcat. So basically Apache is an HTTP Server, serving
HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.
IDE’s (Integrated Development Environment)
1. Eclipse
2. MyEclipse
3. NetBeans
4. intelliJ
Database SQL Queries
• INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...); // to insert the data into the database
• SELECT  SELECT * FROM table_name; //to extract all records from database
• WHERE  SELECT column1, column2, ...
FROM table_name
WHERE condition; //to extract record based on some condition
• UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition; //to update columns based on some condition
• DELETE FROM table_name WHERE condition; //to delete particular record
Statement VS PreparedStatement
Cookies in Servlet/JSP
1. A cookie is a small piece of information that is persisted between the multiple client
requests.
2. A cookie has a name, a single value, and optional attributes such as a comment, path and
domain qualifiers, a maximum age, and a version number.
How Cookie works
By default, each request is considered as a new request. In cookies technique, we add cookie
with response from the Servlet/JSP. So cookie is stored in the cache of the browser. After
that if request is sent by the user, cookie is added with request by default. Thus, we
recognize the user as the old user.
Types of Cookie
There are 2 types of cookies in Servlets/JSP.
1. Non-persistent cookie
2. Persistent cookie
1. Non-persistent cookie
It is valid for single session only. It is removed each time when user closes the browser.
2. Persistent cookie
It is valid for multiple session . It is not removed each time when user closes the browser. It
is removed only if user logout.
Advantage of Cookies
1. Simplest technique of maintaining the state.
2. Cookies are maintained at client side.
Disadvantage of Cookies
1. It will not work if cookie is disabled from the browser.
2. Only textual information can be set in Cookie object.
Session in Servlet/JSP
1. Session simply means a particular interval of time.
2. Session Tracking is a way to maintain state (data) of an user. It is also known as session
management.
3. Session is used To recognize the user It is used to recognize the particular user.
HttpSession
Http protocol is a stateless so we need to maintain state using session tracking techniques.
Each time user requests to the server, server treats the request as the new request. So we
need to maintain the state of an user to recognize to particular user.
How to create Session object
The HttpServletRequest interface provides two methods to get the object of HttpSession:
1. public HttpSession getSession(): Returns the current session associated with this
request, or if the request does not have a session, creates one.
2. public HttpSession getSession(boolean create): Returns the current HttpSession
associated with this request or, if there is no current session and create is true, returns a
new session.
Commonly used methods of HttpSession interface
1. public String getId(): Returns a string containing the unique identifier value.
2. public long getCreationTime(): Returns the time when this session was created,
measured in milliseconds.
3. public long getLastAccessedTime(): Returns the last time the client sent a request
associated with this session, as the number of milliseconds.
4. public void invalidate(): Invalidates this session then unbinds any objects bound to it.

More Related Content

PDF
Java servlets
Mukesh Tekwani
 
PPTX
java Servlet technology
Tanmoy Barman
 
PPTX
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
PPTX
Servlets
Rajkiran Mummadi
 
PPTX
Servlets
Akshay Ballarpure
 
PPTX
Java Servlets
KushagraChadha1
 
PDF
JDBC in Servlets
Eleonora Ciceri
 
PPT
Java Servlet
Rajiv Gupta
 
Java servlets
Mukesh Tekwani
 
java Servlet technology
Tanmoy Barman
 
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
Java Servlets
KushagraChadha1
 
JDBC in Servlets
Eleonora Ciceri
 
Java Servlet
Rajiv Gupta
 

What's hot (20)

PPT
1 java servlets and jsp
Ankit Minocha
 
PPTX
Session And Cookies In Servlets - Java
JainamParikh3
 
PPTX
Servlets
ZainabNoorGul
 
PPTX
Servlet.ppt
VMahesh5
 
PPT
Java Servlets
Nitin Pai
 
PDF
Java EE 01-Servlets and Containers
Fernando Gil
 
PPTX
Enterprise java unit-1_chapter-3
sandeep54552
 
PPT
Servlet ppt by vikas jagtap
Vikas Jagtap
 
PPTX
Servlets & jdbc
Siva Priya
 
PDF
Jdbc 1
Mukesh Tekwani
 
PPT
An Introduction To Java Web Technology
vikram singh
 
PPT
Java Servlets
BG Java EE Course
 
PPT
Java - Servlet - Mazenet Solution
Mazenetsolution
 
PPTX
Javax.servlet,http packages
vamsi krishna
 
PPTX
Chapter 3 servlet & jsp
Jafar Nesargi
 
PPTX
Servlets
Geethu Mohan
 
DOC
Java Servlets & JSP
Manjunatha RK
 
PDF
java servlet and servlet programming
Kumar
 
PPTX
Enterprise java unit-2_chapter-3
sandeep54552
 
1 java servlets and jsp
Ankit Minocha
 
Session And Cookies In Servlets - Java
JainamParikh3
 
Servlets
ZainabNoorGul
 
Servlet.ppt
VMahesh5
 
Java Servlets
Nitin Pai
 
Java EE 01-Servlets and Containers
Fernando Gil
 
Enterprise java unit-1_chapter-3
sandeep54552
 
Servlet ppt by vikas jagtap
Vikas Jagtap
 
Servlets & jdbc
Siva Priya
 
An Introduction To Java Web Technology
vikram singh
 
Java Servlets
BG Java EE Course
 
Java - Servlet - Mazenet Solution
Mazenetsolution
 
Javax.servlet,http packages
vamsi krishna
 
Chapter 3 servlet & jsp
Jafar Nesargi
 
Servlets
Geethu Mohan
 
Java Servlets & JSP
Manjunatha RK
 
java servlet and servlet programming
Kumar
 
Enterprise java unit-2_chapter-3
sandeep54552
 
Ad

Similar to Advanced java+JDBC+Servlet (20)

PDF
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
PPTX
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
PPT
session and cookies.ppt
Jayaprasanna4
 
PPTX
CS8651 IP Unit 3.pptx
Vigneshkumar Ponnusamy
 
PDF
Bt0083 server side programing
Techglyphs
 
PPTX
Advance Java Topics (J2EE)
slire
 
PPTX
servlets sessions and cookies, jdbc connectivity
snehalatha790700
 
PPT
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
shubhangimalas1
 
PPT
Servlet (1) also contains code to create it.ppt
juhishrivastava25
 
DOCX
It and ej
Harihar Kalia
 
PPT
Servlet.ppt
MouDhara1
 
PPT
Servlet.ppt
kstalin2
 
PPT
Servlet1.ppt
KhushalChoudhary14
 
PPTX
Servlets-UNIT3and introduction to servlet
RadhikaP41
 
PPTX
AJppt.pptx
SachinSingh217687
 
PPTX
SERVIET
sathish sak
 
PPTX
Advance Java
Maitree Patel
 
DOCX
Server side programming bt0083
Divyam Pateriya
 
DOCX
Major project report
Omprakash Dhakad
 
PPTX
J2EE : Java servlet and its types, environment
joearunraja2
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
session and cookies.ppt
Jayaprasanna4
 
CS8651 IP Unit 3.pptx
Vigneshkumar Ponnusamy
 
Bt0083 server side programing
Techglyphs
 
Advance Java Topics (J2EE)
slire
 
servlets sessions and cookies, jdbc connectivity
snehalatha790700
 
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
shubhangimalas1
 
Servlet (1) also contains code to create it.ppt
juhishrivastava25
 
It and ej
Harihar Kalia
 
Servlet.ppt
MouDhara1
 
Servlet.ppt
kstalin2
 
Servlet1.ppt
KhushalChoudhary14
 
Servlets-UNIT3and introduction to servlet
RadhikaP41
 
AJppt.pptx
SachinSingh217687
 
SERVIET
sathish sak
 
Advance Java
Maitree Patel
 
Server side programming bt0083
Divyam Pateriya
 
Major project report
Omprakash Dhakad
 
J2EE : Java servlet and its types, environment
joearunraja2
 
Ad

More from Anuj Singh Rajput (20)

PPTX
Web technology
Anuj Singh Rajput
 
PPTX
Java script
Anuj Singh Rajput
 
PPTX
Html (hypertext markup language)
Anuj Singh Rajput
 
PPTX
Bootstrap
Anuj Singh Rajput
 
PPTX
Jsp session 13
Anuj Singh Rajput
 
PPTX
Jsp session 12
Anuj Singh Rajput
 
PPTX
Jsp session 11
Anuj Singh Rajput
 
PPTX
Jsp session 10
Anuj Singh Rajput
 
PPTX
Jsp session 9
Anuj Singh Rajput
 
PPTX
Jsp session 8
Anuj Singh Rajput
 
PPTX
Jsp session 7
Anuj Singh Rajput
 
PPTX
Jsp session 6
Anuj Singh Rajput
 
PPTX
Jsp session 5
Anuj Singh Rajput
 
PPTX
Jsp session 4
Anuj Singh Rajput
 
PPTX
Jsp session 3
Anuj Singh Rajput
 
PPTX
Jsp session 2
Anuj Singh Rajput
 
PPTX
Jsp session 1
Anuj Singh Rajput
 
PPTX
Servlet session 14
Anuj Singh Rajput
 
PPTX
Servlet session 13
Anuj Singh Rajput
 
Web technology
Anuj Singh Rajput
 
Java script
Anuj Singh Rajput
 
Html (hypertext markup language)
Anuj Singh Rajput
 
Jsp session 13
Anuj Singh Rajput
 
Jsp session 12
Anuj Singh Rajput
 
Jsp session 11
Anuj Singh Rajput
 
Jsp session 10
Anuj Singh Rajput
 
Jsp session 9
Anuj Singh Rajput
 
Jsp session 8
Anuj Singh Rajput
 
Jsp session 7
Anuj Singh Rajput
 
Jsp session 6
Anuj Singh Rajput
 
Jsp session 5
Anuj Singh Rajput
 
Jsp session 4
Anuj Singh Rajput
 
Jsp session 3
Anuj Singh Rajput
 
Jsp session 2
Anuj Singh Rajput
 
Jsp session 1
Anuj Singh Rajput
 
Servlet session 14
Anuj Singh Rajput
 
Servlet session 13
Anuj Singh Rajput
 

Recently uploaded (20)

PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PPTX
Trends in pediatric nursing .pptx
AneetaSharma15
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PDF
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Trends in pediatric nursing .pptx
AneetaSharma15
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
CDH. pptx
AneetaSharma15
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 

Advanced java+JDBC+Servlet

  • 2. JDBC (Java DataBase Connectivity) There are four types of JDBC drivers: 1. JDBC-ODBC Bridge Driver 2. Native Driver 3. Network Protocol Driver 4. Thin Driver
  • 3. 1) JDBC-ODBC bridge driver The JDBC-ODBC bridge driver uses ODBC driver to connect to the database. The JDBC-ODBC bridge driver converts JDBC method calls into the ODBC function calls. This is now discouraged because of thin driver.
  • 4. Advantages 1. easy to use. 2. can be easily connected to any database. Disadvantages 1. Performance degraded because JDBC method call is converted into the ODBC function calls. 2. The ODBC driver needs to be installed on the client machine. 2. Native-API driver The Native API driver uses the client-side libraries of the database. The driver converts JDBC method calls into native calls of the database API. It is not written entirely in java.
  • 5. Advantages 1. performance upgraded than JDBC-ODBC bridge driver. Disadvantages 1. The Native driver needs to be installed on the each client machine. 2. The Vendor client library needs to be installed on client machine.
  • 6. 3) Network Protocol driver The Network Protocol driver uses middleware (application server) that converts JDBC calls directly or indirectly into the vendor-specific database protocol. It is fully written in java.
  • 7. Advantages 1. No client side library is required because of application server that can perform many tasks like auditing, load balancing, logging etc.. Disadvantages 1. Network support is required on client machine. 2. Requires database-specific coding to be done in the middle tier. 3. Maintenance of Network Protocol driver becomes costly because it requires database- specific coding to be done in the middle tier. 4) Thin driver The thin driver converts JDBC calls directly into the vendor-specific database protocol. That is why it is known as thin driver. It is fully written in Java language.
  • 8. Advantages 1. Better performance than all other drivers. 2. No software is required at client side or server side. Disadvantages 1. Drivers depend on the Database.
  • 9. Java Database Connectivity with 5 Steps 1. Register the Driver class 2. Create connection 3. Create statement 4. Execute queries 5. Close connection
  • 10. Servlet 1. Servlet is a technology which is used to create a web application. 2. Servlet is an API that provides many interfaces and classes including documentation. 3. Servlet is an interface that must be implemented for creating any Servlet. 4. Servlet is a class that extends the capabilities of the servers and responds to the incoming requests. It can respond to any requests. 5. Servlet is a web component that is deployed on the server to create a dynamic web page.
  • 11. Advantages of Servlet 1. Better performance: because it creates a thread for each request, not process. 2. Portability: because it uses Java language. 3. Robust: JVM manages Servlets, so we don't need to worry about the memory leak, garbage collection, etc. 4. Secure: because it uses java language.
  • 13. Steps for Servlet execution 1. Servlet class is loaded. 2. Servlet instance is created. 3. init method is invoked. 4. service method is invoked. 5. destroy method is invoked.
  • 14. HttpServlet Class The HttpServlet class extends the GenericServlet class and implements Serializable interface. It provides http specific methods such as doGet, doPost, etc. Methods of HttpServlet class There are many methods in HttpServlet class. They are as follows: 1. public void service(ServletRequest req,ServletResponse res) dispatches the request to the protected service method by converting the request and response object into http type. 2. protected void service(HttpServletRequest req, HttpServletResponse res) receives the request from the service method, and dispatches the request to the method depending on the incoming http request type. 3. protected void doGet(HttpServletRequest req, HttpServletResponse res) handles the GET request. It is invoked by the web container. 4. protected void doPost(HttpServletRequest req, HttpServletResponse res) handles the POST request. It is invoked by the web container.
  • 15. Apache Tomcat Server 1. Apache Tomcat is an open source web server that is developed by Apache software foundation. It basically make our Java Web applications to run on host and server based system and it is configured on local host port 8080. 2. Apache Tomcat is used to deploy your Java Servlets and JSPs. So in your Java project you can build your WAR (short for Web ARchive) file, and just drop it in the deploy directory in Tomcat. So basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.
  • 16. IDE’s (Integrated Development Environment) 1. Eclipse 2. MyEclipse 3. NetBeans 4. intelliJ Database SQL Queries • INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); // to insert the data into the database • SELECT  SELECT * FROM table_name; //to extract all records from database • WHERE  SELECT column1, column2, ... FROM table_name WHERE condition; //to extract record based on some condition • UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; //to update columns based on some condition • DELETE FROM table_name WHERE condition; //to delete particular record
  • 18. Cookies in Servlet/JSP 1. A cookie is a small piece of information that is persisted between the multiple client requests. 2. A cookie has a name, a single value, and optional attributes such as a comment, path and domain qualifiers, a maximum age, and a version number. How Cookie works By default, each request is considered as a new request. In cookies technique, we add cookie with response from the Servlet/JSP. So cookie is stored in the cache of the browser. After that if request is sent by the user, cookie is added with request by default. Thus, we recognize the user as the old user. Types of Cookie There are 2 types of cookies in Servlets/JSP. 1. Non-persistent cookie 2. Persistent cookie
  • 19. 1. Non-persistent cookie It is valid for single session only. It is removed each time when user closes the browser. 2. Persistent cookie It is valid for multiple session . It is not removed each time when user closes the browser. It is removed only if user logout. Advantage of Cookies 1. Simplest technique of maintaining the state. 2. Cookies are maintained at client side. Disadvantage of Cookies 1. It will not work if cookie is disabled from the browser. 2. Only textual information can be set in Cookie object.
  • 20. Session in Servlet/JSP 1. Session simply means a particular interval of time. 2. Session Tracking is a way to maintain state (data) of an user. It is also known as session management. 3. Session is used To recognize the user It is used to recognize the particular user. HttpSession Http protocol is a stateless so we need to maintain state using session tracking techniques. Each time user requests to the server, server treats the request as the new request. So we need to maintain the state of an user to recognize to particular user.
  • 21. How to create Session object The HttpServletRequest interface provides two methods to get the object of HttpSession: 1. public HttpSession getSession(): Returns the current session associated with this request, or if the request does not have a session, creates one. 2. public HttpSession getSession(boolean create): Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
  • 22. Commonly used methods of HttpSession interface 1. public String getId(): Returns a string containing the unique identifier value. 2. public long getCreationTime(): Returns the time when this session was created, measured in milliseconds. 3. public long getLastAccessedTime(): Returns the last time the client sent a request associated with this session, as the number of milliseconds. 4. public void invalidate(): Invalidates this session then unbinds any objects bound to it.