JSP如何写入多个COOKIE?????
在JSP页面中要向客户端写入一个cookieName,cookieValue的代码为:Cookiecookie=newCookie(cookieName,cookieVa...
在JSP页面中要向客户端写入一个cookieName,cookieValue的代码为:
Cookie cookie=new Cookie(cookieName,cookieValue);
response.addCookie(cookie);
但如果要写入客户端的两个或三个,如:
cookieName,cookieValue cookieName2,cookieValue2
cookieName3,cookieValue3
是创建多个对象COOKIE对象还是该怎么做???? 展开
Cookie cookie=new Cookie(cookieName,cookieValue);
response.addCookie(cookie);
但如果要写入客户端的两个或三个,如:
cookieName,cookieValue cookieName2,cookieValue2
cookieName3,cookieValue3
是创建多个对象COOKIE对象还是该怎么做???? 展开
2个回答
展开全部
Cookie cookie1=new Cookie(cookieName1,cookieValue1);
Cookie cookie2=new Cookie(cookieName2,cookieValue2);
Cookie cookie3=new Cookie(cookieName3,cookieValue3);
response.addCookie(cookie1);
response.addCookie(cookie2);
response.addCookie(cookie3);
Cookie cookie2=new Cookie(cookieName2,cookieValue2);
Cookie cookie3=new Cookie(cookieName3,cookieValue3);
response.addCookie(cookie1);
response.addCookie(cookie2);
response.addCookie(cookie3);
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询