• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setPath method in cookies

 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the purpose of using setPath() method of cookies. can someone pls give example also where it is used.

thnx in advance
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Have a look at this. Cookies where first defined by Netscape a number of years ago, and everyone seems to have adopted them since.

The setPath method can be used to limit the scope of the cookie, that is 2 servlets can set a cookie with the same name and if they both set the path so that the other servlet can't see their cookie then both exist quite happily, even though they have the same name. So setPath is kind of like setting the scope of a cookie, which parts of your application can see which cookies.

Mat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic