This discussion is archived
5 Replies Latest reply: Aug 3, 2012 12:27 AM by gimbal2 RSS

HttpSession vs Cookie

800839 Newbie
Currently Being Moderated
Hi,

What is the difference between Session and Cookie apart from the session is a server object and cookie resides in the browser. When which should be used. Any examples are appreciated.

Thanks.
  • 1. Re: HttpSession vs Cookie
    ramp Explorer
    Currently Being Moderated
    <sigh> You really need a good servlet book
  • 2. Re: HttpSession vs Cookie
    gimbal2 Guru
    Currently Being Moderated
    Why? Session and cookie are two concepts that are absolutely not specific to servlets at all. Any half-decent Google search will provide information about either in no time.

    And that's where I <sigh>. So much information at your fingertips and still you don't reach for it...



    EDIT: okay okay okay, I get it. You were taking the post history into account. Then I agree ;)
  • 3. Re: HttpSession vs Cookie
    DrClap Expert
    Currently Being Moderated
    gimbal2 wrote:
    EDIT: okay okay okay, I get it. You were taking the post history into account. Then I agree ;)
    No kidding. It's just a litany of bad practices. I counted half a dozen questions to which the answer was "Just don't do that".
  • 4. Re: HttpSession vs Cookie
    ramp Explorer
    Currently Being Moderated
    gimbal2 wrote:
    Why? Session and cookie are two concepts that are absolutely not specific to servlets at all. Any half-decent Google search will provide information about either in no time.

    And that's where I <sigh>. So much information at your fingertips and still you don't reach for it...



    EDIT: okay okay okay, I get it. You were taking the post history into account. Then I agree ;)
    :), yes the OP is trying to learn servlets/jsp from scratch through this forum.
  • 5. Re: HttpSession vs Cookie
    gimbal2 Guru
    Currently Being Moderated
    DrClap wrote:
    gimbal2 wrote:
    EDIT: okay okay okay, I get it. You were taking the post history into account. Then I agree ;)
    No kidding. It's just a litany of bad practices. I counted half a dozen questions to which the answer was "Just don't do that".
    Still, its nothing uncommon... And what is also not uncommon is that when you mention "Don't do that, do THIS in stead" the reply is "ha ha yeah that's much better, but can you show me my way anyway please?"...

    I pose a question to my persistent and/or newly acquired brothers in arms who do not run away shaking their heads like so many before us (BalusC, Ceci, ...) - were you perhaps spanked as a child? There must be something common in our past that we like this sort of abuse.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points