• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

getCookies() returning junk data  RSS feed

 
Ranch Hand
Posts: 43
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi have just started to learn cookie tracking mechanism but for some reason getCookie() method is returning junk data. Here is my code:

index.html




AddData.java




ShowData.java



Output of showdata should be something like, student name: xyz    student address: address  but i am getting this output  
ext_name:jaehkpjddfdgiiefcnhahapilbejohhj

Please let me know where i am going wrong
 
Rancher
Posts: 3737
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see where you've added those Cookies to the Response object in the first servlet.

One thing, don't use processRequest().  It's incredibly dated, and wasn't even advisable back then.
Your form does a GET, so only the doGet should be written, and the doPost should return a suitable error code.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!