This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes cookies are persistence? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "cookies are persistence?" Watch "cookies are persistence?" New topic

cookies are persistence?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
Whether cookies are persistence? because cookies are stored in the local disk.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
They are persistent on that machine if the expire attribute is set. They are not persistent if you need that information and the user logs on another machine.

Is that what you are after?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

The quick answer is "Yes, sort of".

Firstly there are two types, persistent and session cookies. The persistent type get written to the filesystem, the session ones get destroyed when you close the browser.

It is poor form to use them as a type of persistence though. Firstly they can be blocked by many browsers or deleted by users, so you can't rely on them. They are also accessible by the user, so the user can read the data and potentially change it.

Consider a simple case where someone logs into your system and to prevent them having to log in again, you write their user ID to their local file system as a cookie. By changing the cookie value, the user now has the ability to log in as anyone they like.
I agree. Here's the link:
subject: cookies are persistence?
Similar Threads
remember user password in jsp/java
WA #1.....word association
Session Doubt?
Session sharing (JSP-PHP)
handling next and back buttons in javascript