Tell me how does cookies work in Servlets?
Submitted by: Muhammad☛ Cookies are text data sent by server to the client and it gets saved at the client local machine.
☛ Servlet API provides cookies support through javax.servlet.http.Cookie class that implements Serializable and Cloneable interfaces.
☛ HttpServletRequest getCookies() method is provided to get the array of Cookies from request, since there is no point of adding Cookie to request, there are no methods to set or add cookie to request.
☛ Similarly HttpServletResponse addCookie(Cookie c) method is provided to attach cookie in response header, there are no getter methods for cookie.
Submitted by: Muhammad
☛ Servlet API provides cookies support through javax.servlet.http.Cookie class that implements Serializable and Cloneable interfaces.
☛ HttpServletRequest getCookies() method is provided to get the array of Cookies from request, since there is no point of adding Cookie to request, there are no methods to set or add cookie to request.
☛ Similarly HttpServletResponse addCookie(Cookie c) method is provided to attach cookie in response header, there are no getter methods for cookie.
Submitted by: Muhammad
Read Online Sr.Java Web Developer Job Interview Questions And Answers
Top Sr.Java Web Developer Questions
☺ | Do you know what is composition in Java? |
☺ | Please explain what is the difference between execute, executeQuery, executeUpdate? |
☺ | Tell us what is Hibernate Framework? |
☺ | Tell me what are the different tags provided in JSTL? |
☺ | Tell us what is difference between Error and Exception? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |