• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cookie question

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

I have a question regarding cookies.

Lets say I signup with Website_A and it sets a "username" cookie in my machine, so it can print 'hello praveen' the next time I visit that page.

Now I log into Website_B and it looks for a "username" cookie to say 'hello praveen' on the welcome screen. Now since this is the first time im visiting the page will it NOT print 'hello praveen' OR will it pick the cookie set earlier by a difference application which incidentally has the same name ?

Im under the impression that all cookies(from all webpages) are saved in a particular place in the client machine. Since they have only a name and a value how can it be related to a particular servlet/webpp etc. ?

Please advice
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put simply, the browser is not supposed to send all cookies to all web-pages. Only the cookies originating from the domain of the server in question should be enclosed with the request.
This behaviour can be verified by surfing around for a while and then writing a servlet or JSP that retrieves and displays the cookies in a request. Compare the cookies displayed by your servlet/JSP with the cookies your browser tell you are present on your machine. Allowing sites to set cookies in your browser is a prerequisite.
[ June 22, 2007: Message edited by: Navi Nirsak ]
 
praveen Shangunathan
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Navi.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This question might not fit well here. But sorry, could not find a more apt thread. Coming to the question what can be the data types of the (key, value) pair that goes into the cookie constructor? I know that the key can only be a string ... but can the value be of any data type including any non-primitive ones?

Thanks,
Madhuri
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic