How to set a cookie and how to access it in diff jsp

hi,

I am setting a cookie ,in one jsp . and retrieving in another jsp. I am unable to get that cookie in the second jsp.

Say,  I am setting in one.jsp, and retrieving in two.jsp.

In one.jsp the cookie was set..fine.. in two.jsp, its not there. If i try to access the cookie in one.jsp itself, its accessible. two.jsp is the one ,i am calling that thru Ajax and not thru form action method. Will it be a problem?


Any idea? Like do I have to mention any paths/domains .?
jyothisreeAsked:
Who is Participating?
 
Ajay-SinghCommented:
Yes, those 2 jsps should be on the same domain, you setDomain method to set a common domain
0
 
jyothisreeAuthor Commented:
ya...i kept... setDomain and setPath both..then it worked..thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.