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

What are the kinds of http requests?

1021


What’s the difference between forward() and sendredirect() methods?

1000


Is it possible to have a constructor inside the servlet?

995


What are the different methods involved in the process of session management in servlets?

1249


Which protocol will be used by browser and servlet to communicate

1040


What is lazy loading and what is Generic Servlet Class?

1059


What exactly are the functions of servlet?

1082


What is servlet attributes and their scope?

1043


What is SingleThreadModel interface?

1132


Why the container loads server at the application startup and how?

1042


What is the effective way to make sure all the servlets are accessible only when user has a valid session?

1041


Define servlet mapping?

1144


How will two or three servlets interact or communicate with each other?

1438


What are different ways for authentication of servlet?

1064


What is servlet and its life cycle?

1104