Kizspy | Question: 35
(Choose 1 answer)
FUOVERFL
public class CookieExampleServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO: Your code here
}
}
In the doGet method, how to create a Cookie and send it to the client?
A. Cookie newCookie = new Cookie("username", "john_doe"); response.addCookie(newCookie);
B. response.setCookie("username", "john_doe");
C. request.createCookie("username", "john_doe");response.sendCookie();
D. Cookie.create("username", "john_doe");response.writeCookie();