This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes cookies availability? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "cookies availability?" Watch "cookies availability?" New topic

cookies availability?

jamil lusa
Ranch Hand

Joined: Aug 18, 2011
Posts: 59
hi all, i have a question related to cookie:

if i create a cookie at (set path to '/') after that i create another cookies (set path to '/ext/abc'. now if the user browser, which cookie will probably be sent to server? first one or second one?


second question:

The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's subdirectories. A cookie's path must include the servlet that set the cookie, for example, /catalog, which makes the cookie visible to all directories on the server under /catalog.

above java doc quote from setPath function in HttpCookie class.

if i set cookie at, is 'login' ('login' is a servelt or jsp) needed to be included in path parameter? for example, setPath("/user") is allowed?

thanks any reply in advanced.
I agree. Here's the link:
subject: cookies availability?
It's not a secret anymore!