JSP Tutorials - Herong's Tutorial Examples
∟JSP Application Session
∟The "session" Implicit Object
This section describes the 'session' implicit object - a javax.servlet.http.HttpSession object provided by the JSP server to hold information and methods common to all JSP pages running under one session.
What Is the "session" Implicit Object?:
The "session" implicit object is an object provided by the JSP server to hold information and methods
common to all JSP pages running under one session. The session object must be an instance
of a class that implements the javax.servlet.http.HttpSession interface defined by the J2EE
specification. Here are some methods of the HttpSession interface defined in J2EE 1.6:
- getAttribute(): Returns the object that is associated to the specified key string.
defined in the session.
- getAttributeNames(): Returns an Enumeration object that contains all the key strings
defined in the session.
- getCreationTime(): Returns the time when this session was created, measured
in milliseconds since midnight January 1, 1970 GMT.
- getId(): Returns the session ID as a string.
- getLastAccessedTime(): Returns the last time the client sent a request
associated with this session, as the number of milliseconds since midnight
January 1, 1970 GMT.
- getMaxInactiveInterval(): Returns the maximum time interval, in seconds,
that the servlet container will keep this session open between client accesses.
- getServletContext(): Returns the ServletContext to which this session belongs.
- invalidate(): Invalidates this session then unbinds any objects bound to it.
- removeAttribute(): Removes the object associated with the specified key string
from this session.
- setAttribute(): Associate an object with the specified key string and store them
to this session.
- setMaxInactiveInterval(): Specifies the time, in seconds, between client
requests before the servlet container will invalidate this session.
Table of Contents
About This Book
JSP (JavaServer Pages) Overview
Tomcat Installation on Windows Systems
JSP Scripting Elements
Java Servlet Introduction
JSP Implicit Objects
Syntax of JSP Pages and JSP Documents
►JSP Application Session
What Is a Session
►The "session" Implicit Object
Passing Values between JSP Pages
Testing Result of RegForm.jspx
Using Perl LWP Package for Debugging
Managing Cookies in JSP Pages
JavaBean Objects and "useBean" Action Elements
Managing HTTP Response Header Lines
Non-ASCII Characters Support in JSP Pages
Performance of JSP Pages
EL (Expression Language)
Overview of JSTL (JSP Standard Tag Libraries)
JSTL Core Library
JSP Custom Tags
JSP Java Tag Interface
Custom Tag Attributes
Multiple Tags Working Together
File Upload Test Application
Using Tomcat on CentOS Systems
Using Tomcat on macOS Systems
Connecting to SQL Server from Servlet
Developing Web Applications with Servlet
Archived Tutorials
References
Full Version in PDF/EPUB