News:

Build a stunning handcrafted website with IT Acumens

Main Menu

Tips to set a cookie in JSP

Started by karthick, Aug 24, 2008, 07:05 PM

Previous topic - Next topic

karthick

Tips to set a cookie in JSP



response.setHeader(”Set-Cookie”, “cookie string”);
To give the response-object to a bean, write a method setResponse
(HttpServletResponse response)
- to the bean, and in jsp-file:
<%
bean.setResponse (response);
%>
114) How can I delete a cookie with JSP?
Ans: Say that I have a cookie called “foo,” that I set a while ago & I want it to go away. I simply:
< %
Cookie killCookie = new Cookie("foo", null);
KillCookie.setPath("/");
killCookie.setMaxAge(0);
response.addCookie(killCookie);
% >
A part of Development in Our Website Front Page
www.itacumens.com

We simple build everything with sense
----karthick....