Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cookie Problems  RSS feed

 
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm writing a cookie in my action servlet of my struts app. And then I'm reading the cookie in my JSP page. The problem is that the cookie isn't read. At least it isn't read on the first pass. The second pass (a refresh) the cookie is finally picked up. Any way to get around this and why is this happening. Do all cookie reads have to happen in the Servlet?
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to pass data from a servlet to a page, a cookie is not the best mechanism. You have so much more POWER at your fingertips, why fiddle about with cookies? How about binding an object to a session? Then you'll know if you got the stuff from yourself, or from the client.

--Dale--
 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Servlets...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!