JavaBean for operating cookie
Author: Sea Aberdeen Time: 2003-4-22
Package org.rautinee.util; import java.io. *; import java.beans. *; import java.util. *; import javax.servlet. *; import javax.servlet.http. * ; public class MagCookie extends HttpServlet {/ * add a cookiecookieName - cookie name cookieValue - cookie value * / public void addCookie (HttpServletResponse res, String cookieName, String cookieValue, int cookieMaxAge) {try {Cookie c = new Cookie ( cookieName, cookieValue); c.setMaxAge (cookieMaxAge); res.addCookie (c);} catch (Exception ex) {System.err.print (ex.getMessage ());}} public String getCookieValue (HttpServletRequest req, String cookieName ) {String cookievalue = ""; try {cookie c [] = Req.getCookies (); for (int N = 0; n