Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What are cookies and how will you use them?

Answers were Sorted based on User's Feedback



What are cookies and how will you use them?..

Answer / janet

Cookies are a mechanism that a servlet uses to have a
client hold a small amount of state-information associated
with the user.
a) create a cookie with the cookie constructor:
public Cookie(String name,String value)
b) A Servlet can send a cookie to the client by passing a
Cookie object to the addCookie() method of
HttpServletResponse:
public void HttpServletResponse.addCookie(Cookie
cookie)

c) A servlet retrieves cookie by calling the getCookies()
method of HttpServletRequest:
public Cookie[]HttpServletRequest.getCookie().

Is This Answer Correct ?    3 Yes 0 No

What are cookies and how will you use them?..

Answer / 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

More Servlets Interview Questions

what are the way a client can be tracked?

3 Answers   ABC, IBM,


How can you start a jta transaction from a servlet deployed on jboss?

0 Answers  


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

0 Answers  


Can a jsp be called using a servlet?

0 Answers  


Can I override destroy() method of Servlets?

4 Answers   Accenture,


What is the role of the webserver?

4 Answers  


How are Sessions are more advantage than using of Cookies or URLReWriting?

2 Answers   CTS,


How many ways are available to ger RequestDispatcher object?

4 Answers   Polaris,


How the servlet is loaded?

0 Answers  


What is a servlet engine?

0 Answers  


Which protocol will be used by browser and servlet to communicate

0 Answers  


How to set a cookie that is persisted only for the duration fo the clients session?

1 Answers  


Categories