String name = new String("ID"); String value = new String("123"); Cookie cookie=new Cookie(name,value); res.addCookie(cookie);