What are cookies and how will you use them?

Answer Posted / tulasi vani

Cookies are small bit of textual information that are sent
from the webserver to the browser and sent back from the
browser to the server without changing the data later.

Cookies are helpful during e-commerce sessions when it will
be possible to recoginise a user during a session or it
helps in advertising as we can know the user preferences.

Cookies are created using:

Cookie c=new Cookie("name",value);
response.addCookie(c);

you can retrive the cookie value using:

request.getCookie() which returns a String giving the name
of the cookie and the value associated with the cookie.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the difference between session and cookies in servlet? Explain

558


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

598


Explain their methods? Tell me their parameter names also have you used threads in servlet?

581


What is a web application and what is it’s directory structure?

582


What are the ways to handle multi-threading in servlets?

593






What is the difference between Server and Container?

618


What are the types of Session Tracking ?

642


What is the type of method for sending request from http server?

590


What are different Authentication options available in Servlets.

561


How to get the path of servlet in the server?

531


What do you mean by httpservlet?

561


Where do you define dispatcherservlet?

550


Can you call a jsp from the servlet?

545


List some life cycle methods of a servlet.

586


What is a deployment descriptor?

593