Home Servlets Cookies
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Cookies

Advertisement
This page discusses - Cookies

Setting the Cookies

In this example we are going to set the cookie.

HttpSession session = requsest.getSession();

Inside the service method we ask for a session, and everything happens automatically. We don't need to make a new Cookie object. We don't have any need to associate the session id with the cookie. Even there is no need to set the cookie into the response.

Cookies are just a name/value pair which gets exchanged between client and the server. When the client sends the request to the server for the first time the container generates a unique session id. The server sends the cookie to the client

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Ask Questions?    Discuss: Cookies  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com