UYOU
12345678910111213public void saveCookie(HttpServletResponse resp,String cookieName,String wrd){HttpServletResponse response=resp;try {cookieName=URLDecoder.decode(cookieName, "utf-8");} catch (UnsupportedEncodingException e) {// TODO Auto-generated catch blocke.printStackTrace();}Cookie myCookie=new Cookie(cookieName,wrd);myCookie.setMaxAge((60*60*24)*7);//一天System.out.println("保存成功!");resp.addCookie(myCookie);}这是一个保存cookie的方法 但我实在没看懂你想做什么功能 能详细说一下吗