Session Handling: Cookies

Using cookies is one of the most widely used and accepted ways to maintain a session. A cookie is a special tag identifier that your server generates and the browser accepts. Actually, it is a simple data structure consisting of name-value pairs associated with a URL, in this case, the URL to execute the servlet. For maintaining a session, the servlet stores the session identifier and other session data as a text string in the cookie.

After accepting the session cookie, the browser propagates the cookie to your servlet for every request from the browser to the servlet. A servlet can read the cookie and modify its contents at any time. If there is no cookie, the servlet detects a new session, generates a unique session ...

Get Sams Teach Yourself BEA WebLogic Server 7.0™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.