Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP and Javascript Cookies

 
Vikas Aggarwal
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My simple question is whether I can read cookies set by javascript in JSP and viceversa?

Thanks.
Vikas
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vikas,

The answer to your question is yes.

And now I will anticipate your follow-up question: How?

Hint: use the implicit request object in JSP, figure our how that relates to the HttpServletRequest object and how to access its method for retrieving cookies from the request object. You will likely wind up looping through a Cookie[] array.

In javascript use the cookie property of the document.

Good luck!
[ February 09, 2007: Message edited by: Philip Shanks ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookies are cookies. Whether set in Javascript, or by other means, they all use the same underlying mechanisnms.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic