0

My problem is as the title , and I programmed with Java, following is my code

Cookie cookie = new Cookie("shikaiwenCookie","sended");
cookie.setMaxAge(2000);
cookie.setDomain("/bbs");

enter image description here

this is the information I get from my HTTP monitor. It seems that cookie has been send to the browser. But when I submit my form, the browser did not send the cookie to my server. Could someone help me ? Thanks in advance .

4

1 回答 1

1

我认为您domainpath. 试试setPath("/bbs")

编辑:

域和路径都用于确定 cookie 是否与请求相关。域关注URL中的域名,路径必须path-match与url的路径一致。例如:urlhttp://stackoverflow.com/posts/19489484有 domainstackoverflow.com和 path /posts/19489484。此处 cookie 路径/posts将与 url 中的路径进行路径匹配。

于 2013-10-21T08:27:29.310 回答