Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What are cookies and how will you use them?
#1
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 cookies by calling the getCookies() method of HttpServletRequest: public Cookie[ ] HttpServletRequest. getCookie().
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Describe the difference between cookies, sessionStorage, and localStorage. Kajal 3 13,185 07-15-2020, 12:00 PM
Last Post: RH-Calvin

Forum Jump:


Users browsing this thread: 1 Guest(s)