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
What is servlet and its types?
Can we use the constructor, instead of init(), to initialize servlet?
How servlet is created?
Explain the servlet context.
explain the advantages of servlet life cycle?
What are Servlets?
What are the drawbacks of cgi?
Explain load on start-up and its importance?
What if we pass negative value in load-on-startup?
What are the advantages of Servlet over CGI?
Can filter be used as request or response?
What is called servlet container?
Which application server is best for java?
What is setattribute in servlet?
Can you explain in detail 'javax.servlet' package?