• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getCookies() returning junk data

 
tushar attar
Ranch Hand
Posts: 36
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
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic