Netscape first introduced cookies in one of the company’s first versions of Netscape Navigator.

Cookies: Cookies are information that a Web server sends to a browser and that the browser returns back to web server when visiting the same Web site later. Cookie can be saved in a browser as a key value pair To add a cookie in browser we need to create an object for cookie class and use a HttpResponse object to send the data to browser. To create cookie object: Cookie ck=new Cookie(“key”,”value”) To add cookie to browser response.addCookie(ck); // addCookie method takes cookie objects as argument

getName().i<ck.To get or retrieve the all the cookie present in the browser we need to use a HttpRequest object To get cookie: Cookie ck[]=request.getCookies().length.println("<b><br> Value of the cookie :"+value). out. String value=ck[i]. } .i++) {String str=ck[i]. To display cookie present in cookie array: for(int i=0.getValue().println("<b><br>Name of the Cookie :"+str). out.

Sign up to vote on this title
UsefulNot useful