This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet requires refresh to show cookie values

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the servlet shown below requires a refresh to show cookies values.

servlet :


actually is should show retrieved cookie's name and retrieved cookie's value but i require to refresh it to get those values.
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tushar panda wrote:the servlet shown below requires a refresh to show cookies values.
............
but i want it to auto refresh which is not possible because it user doPost method .

I'm not sure I get your problem, but how are you invoking the servlet ?
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have changed the code , please check it .
Vijitha Kumara wrote:I'm not sure I get your problem, but how are you invoking the servlet ?

i am invoking it by a forward method in requestdispatcher.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookies are a client-side concept. The servlet does not create the cookie, it merely creates headers that tell the browser to create the cookie. Until the headers have been seen by the browser, the cookie does not exist.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic