Example & Tutorial understanding programming in easy ways.

How can I set a cookie and delete a cookie from with in a JSP page?

A cookie, mycookie, can be deleted using the following scriptlet:

<%

//creating a cookie

Cookie mycookie = new Cookie("Name","aValue");

response.addCookie(mycookie);

//delete a cookie

Cookie killMyCookie = new Cookie("mycookie", null);

killMyCookie.setMaxAge(0);

killMyCookie.setPath("/");

response.addCookie(killMyCookie);

%>

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!