• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please clarrify my doubts..

1. when can we use URL writting, hidden fields, cookies and HttpSession to handle session?

2. if the client disabled the cookies, what will happen to the session? how can we handle the session if the client disabled the cookies?

3. is HttpSession uses Cookies ?

thanks ,
Thennam Pandian.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) By default only cookies will be used. Some servers need to to be configured to allow URL rewriting. Hidden fields are not supported by default, and I have never seen them used in Java.

2) If the client 'disables cookies', cookie based sessions may or may not work depending on what they allow. By default session cookies are stored in-memory and not written to the hard drive. In some cases these in-memory cookies will still be allowed but persistent cookies will not.

3) by default sessions use cookies.
 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thank you for your reply.

if the cookies are stored in server side memory, how the server will recognize the request( whether is it a new request or a old request?)
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cookies are never stored on the server.
They are always stored on the client.

Session data is stored on the server.
The only thing stored in the cookie is the sessionID.
This, to answer your question, is how the server knows which client initiated each request and is used to match up the client with their session.
[ May 02, 2008: Message edited by: Ben Souther ]
 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks now i understood Cookies and session ....
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use session..very easy..to use....nice & smooth..

// Create Session...

session.setAttribute("session_name",variable_name);

// Retrive Back ..

variable_name = session.getAttribute("session_name").toString();
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, the original poster wasn't asking how to use sessions.
He was asking how they work.

From the looks of his last post, it appears that his question was answered.


-Ben
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a small servlet to validate my understanding in reference to your question. Posting its code, maybe it helps:

 
bacon. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic