SlideShare a Scribd company logo
Topic:
1. Sessions
2. Session Tracking
3. Session Management
4. Cookies
5. Filters
6. File downloading
Servlets1
Session
 A session is pretty much what it sounds, when
a user makes a page request to the server, the
server creates a temporary session to identify
that user. So when that same user goes to
another page on that site, the server identifies
that user.
 A session is a small and temporary
unique connection between a server and the
user enabling it to identify that user across
multiple page requests or visits to that site.
2
1. What is Session Tracking?
There are a number of problems that arise from
the fact that HTTP is a "stateless" protocol. In
particular, when you are doing on-line
shopping, it is a real annoyance that the Web
server can't easily remember previous
transactions. This makes applications like
shopping carts very problematic:
3
 when you add an entry to your cart, how does
the server know what's already in your cart?
Even if servers did retain contextual
information, you'd still have problems with e-
commerce. When you move from the page
where you specify what you want to buy
(hosted on the regular Web server) to the page
that takes your credit card number and
shipping address (hosted on the secure server
that uses SSL), how does the server
remember what you were buying?
4
There are three typical solutions to this problem.
Cookies. You can use HTTP cookies to store
information about a shopping session, and
each subsequent connection can look up the
current session and then extract information
about that session from some location on the
server machine. This is an excellent
alternative, and is the most widely used
approach.
5
 2.URL Rewriting. You can append some extra
data on the end of each URL that identifies the
session, and the server can associate that
session identifier with data it has stored about
that session. This is also an excellent solution,
and even has the advantage that it works with
browsers that don't support cookies or where
the user has disabled cookies.
6
 3) Hidden form fields. HTML forms have an
entry that looks like the following: <INPUT
TYPE="HIDDEN" NAME="session" VALUE="..
.">. This means that, when the form is
submitted, the specified name and value are
included in the GET or POST data. This can
be used to store information about the session.
7
 Servlets provide a solution:
the HttpSession API. This is a high-level
interface built on top of cookies or URL-
rewriting. In fact, on many servers, they use
cookies if the browser supports them, but
automatically revert to URL-rewriting when
cookies are unsupported or explicitly disabled.
But the servlet author doesn't need to bother
with many of the details, doesn't have to
explicitly manipulate cookies or information
appended to the URL, and is automatically
8
 Why use Session Management ?
Hundreds and thousands of simultaneous
users can be visiting your site and if you can
identify each of them separately then it can
provide tremendous benefits to you.
9

More Related Content

PPTX
PPTX
Web topic 11 importance of html validation
PPT
Agency Express3 0
PPT
Trevor Lyttle - Implementing e-payments at QUB Library
PPT
2310 b 16
PPT
Mailing Website
PPT
Group Web Presentation Week13
PPTX
Mebank
Web topic 11 importance of html validation
Agency Express3 0
Trevor Lyttle - Implementing e-payments at QUB Library
2310 b 16
Mailing Website
Group Web Presentation Week13
Mebank

Similar to Class 38 (20)

PPT
PPTX
Enterprise java unit-2_chapter-3
PPTX
Using cookies and sessions
PPTX
ASP.NET State management
PDF
Servlet sessions
PPTX
Session 32 - Session Management using Cookies
PPTX
Session 33 - Session Management using other Techniques
PPTX
IMPORTANT SESSION TRACKING TECHNIQUES.pptx
PPTX
SessionTrackServlets.pptx
PPT
Session,cookies
PDF
08 session-tracking
PDF
08 session-tracking
PPTX
PPTX
2.session management
PPTX
COOKIES.pptx
PPTX
Sessions&cookies
PPTX
Session tracking In Java
PPTX
Session And Cookies In Servlets - Java
PPTX
19_JavaScript - Storage_Cookies-tutorial .pptx
Enterprise java unit-2_chapter-3
Using cookies and sessions
ASP.NET State management
Servlet sessions
Session 32 - Session Management using Cookies
Session 33 - Session Management using other Techniques
IMPORTANT SESSION TRACKING TECHNIQUES.pptx
SessionTrackServlets.pptx
Session,cookies
08 session-tracking
08 session-tracking
2.session management
COOKIES.pptx
Sessions&cookies
Session tracking In Java
Session And Cookies In Servlets - Java
19_JavaScript - Storage_Cookies-tutorial .pptx
Ad

Recently uploaded (20)

PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
Assigned Numbers - 2025 - Bluetooth® Document
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25-Week II
gpt5_lecture_notes_comprehensive_20250812015547.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
sap open course for s4hana steps from ECC to s4
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
Ad

Class 38

  • 1. Topic: 1. Sessions 2. Session Tracking 3. Session Management 4. Cookies 5. Filters 6. File downloading Servlets1
  • 2. Session  A session is pretty much what it sounds, when a user makes a page request to the server, the server creates a temporary session to identify that user. So when that same user goes to another page on that site, the server identifies that user.  A session is a small and temporary unique connection between a server and the user enabling it to identify that user across multiple page requests or visits to that site. 2
  • 3. 1. What is Session Tracking? There are a number of problems that arise from the fact that HTTP is a "stateless" protocol. In particular, when you are doing on-line shopping, it is a real annoyance that the Web server can't easily remember previous transactions. This makes applications like shopping carts very problematic: 3
  • 4.  when you add an entry to your cart, how does the server know what's already in your cart? Even if servers did retain contextual information, you'd still have problems with e- commerce. When you move from the page where you specify what you want to buy (hosted on the regular Web server) to the page that takes your credit card number and shipping address (hosted on the secure server that uses SSL), how does the server remember what you were buying? 4
  • 5. There are three typical solutions to this problem. Cookies. You can use HTTP cookies to store information about a shopping session, and each subsequent connection can look up the current session and then extract information about that session from some location on the server machine. This is an excellent alternative, and is the most widely used approach. 5
  • 6.  2.URL Rewriting. You can append some extra data on the end of each URL that identifies the session, and the server can associate that session identifier with data it has stored about that session. This is also an excellent solution, and even has the advantage that it works with browsers that don't support cookies or where the user has disabled cookies. 6
  • 7.  3) Hidden form fields. HTML forms have an entry that looks like the following: <INPUT TYPE="HIDDEN" NAME="session" VALUE=".. .">. This means that, when the form is submitted, the specified name and value are included in the GET or POST data. This can be used to store information about the session. 7
  • 8.  Servlets provide a solution: the HttpSession API. This is a high-level interface built on top of cookies or URL- rewriting. In fact, on many servers, they use cookies if the browser supports them, but automatically revert to URL-rewriting when cookies are unsupported or explicitly disabled. But the servlet author doesn't need to bother with many of the details, doesn't have to explicitly manipulate cookies or information appended to the URL, and is automatically 8
  • 9.  Why use Session Management ? Hundreds and thousands of simultaneous users can be visiting your site and if you can identify each of them separately then it can provide tremendous benefits to you. 9