Sunday, February 7, 2010

JSP Program to Delete a Cookie Values

JSP is a dynamic scripting capability for web pages that allows Java as well as a few special tags to be embedded into a web file (HTML/XML, etc). The suffix traditionally ends with .jsp to indicate to the web server that the file is a JSP files. JSP is a server side technology - you can’t do any client side validation with it. The JSP assists in making the HTML more functional. Servlets on the other hand allow outputting of HTML but it is a tedious process. It is easy to make a change and then let the JSP capability of the web server you are using deal with
compiling it into a servlet and running it.

Sample JSP Program to Delete a Cookie Value:

<%
Cookie killCookie = new Cookie(“Ck”, null);

KillCookie.setPath(“/”);

killCookie.setMaxAge(0);

response.addCookie(killCookie);

%>
JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed.

2 comments:

clawid,  February 8, 2010 at 12:22 AM  

Thanks for the Great Info. It will be a great help in making out my sikat ang pinoy website

Anonymous,  June 2, 2010 at 11:39 PM  

how to delete more the one cookie in jsp page.
help me.

Blog Widget by LinkWithin

JS-Kit Comments

  © Blogger template Newspaper III by Ourblogtemplates.com 2008

Back to TOP