In servlets, which method is used to add a cookie to the response headers?
- response.addCookie(Cookie cookie);
- response.createCookie(Cookie cookie);
- response.insertCookie(Cookie cookie);
- response.setCookie(Cookie cookie);
The correct method to add a cookie to the response headers in servlets is response.addCookie(Cookie cookie);.
Loading...
Related Quiz
- What is the best practice for handling SQL exceptions in a multi-tier application?
- What is the primary purpose of using filters in web applications?
- Which one directly interacts with the Java server pages (JSP) container?
- A transaction's property ensuring that either all its operations are completed successfully, or none are, is known as _________.
- Which HTTP status code is typically sent by an HTTP servlet to indicate a successful response?