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?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between generic servlet and http servlet?

1007


How do you get the ip address of the client in servlet?

1017


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

1169


What are the two important api's in for servlets?

1095


What is the importance of init() method in Servlet ?

1087


How we can call a jsp from the servlet?

1012


What is difference between cookies and httpsession?

1105


What is servlet and its types?

1064


What is servlet api used for conneting database?

1238


How do we share data using 'getservletcontext ()?

1054


What are some advantages of storing session state in cookies?

1023


How to find whether a parameter exists in the request object?

1117


What if we pass negative value in load-on-startup?

1285


Why are servlets used?

1045


What is SingleThreadModel interface?

1155