• 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

Storing data in cookies

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Thanks a lot in advance.
How can we store data in cookies.
i.e., I have search functionality where user can search for various things, If user searched for some f1, f2 in previous times then suppose if he is searching for third I need to show earlier searchs like f1 and f2. As we dont have any user specific data we should keep this data in some cookies.
Please help me.
And one more without user information how can we store data in data base, like i dont have any user id or any thing user specific and if he came back after some days how I can I show his/her previous data.

Regards,
Sree
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the JavaDocs for HttpServletResponse for methods to set cookies.
For retrieval of cookie data see HttpServletRequest JavaDocs.
For the related Http standard see the RFC 2965.

Every Java programmer working with servlets should have the Javadocs on hand for questions like this.

Bill
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can probably use a unique identifier (key value pair having a uniquely generated name) as part of your cookie string to identify the user...technically it is the machine/login that you are referring to. This might work until the user clears his cookies. I believe I did understand your requirements.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic