The browser isexpected to support 20 cookies for each Web server, 300 cookies total, and maylimit cookie size to 4 KB each.Several cookies might have the same name butdifferent path attributes.
About the method ofCookie:
(1.setPath(String)
The cookie isvisible to all the pages in the directory you specify, and all the pages inthat directory's subdirectories. A cookie's path must include the servlet thatset the cookie, for example, /catalog, which makes the cookie visible to alldirectories on the server under /catalog.
(2.setMaxAge(int)
A negative valuemeans that the cookie is not stored persistently and will be deleted when theWeb browser exits. A zero value causes the cookie to be deleted.
For instance:Demo3/servlet/Timecookie AND Demo3/servlet/DeletCookie.
885

被折叠的 条评论
为什么被折叠?



