Professional Documents
Culture Documents
Session Management: Managing Sessions and Handling Errors
Session Management: Managing Sessions and Handling Errors
Session Management: Managing Sessions and Handling Errors
Session Management
• Session management refers to tracking the state of an end user across Web
pages.
• Session management enables programmers to create applications where the
state of an end user is required to be maintained across multiple Web pages.
Managing Sessions and Handling Errors
• URL Rewriting:
• Cookies:
• Are chunks of information created by the server and are stored by the
browser on the client machine.
• Supported by the Web browser and the size of each cookie is maximum of
4 bytes.
• Are used by the server to find out the computer name, IP address, or any
other details of the client computer.
Managing Sessions and Handling Errors
Method Description
public void setMaxAge(int expiry) Sets the maximum time for which the
client browser retains the cookie value.
• The Servlet Session API provides various interfaces and classes, which can be
used for managing end user sessions. The interfaces defined in the Servlet
Session API are:
• javax.servlet.http.HttpSession
• javax.servlet.http.HttpSessionListener
• javax.servlet.http.HttpSessionBindingListener
Managing Sessions and Handling Errors
Method Description
Method Description
Demonstration-Implementing Session
Management using Session API
• Problem Statement