Meaningless Drivel is fun!*
The moose likes JSP and the fly likes cookie problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "cookie problem" Watch "cookie problem" New topic
Author

cookie problem

tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
jsp page code :



this code should give me cookie name , object and value of two cookies i have set , but it gives only the name,object and value of the JSESSIONID and not the other cookie i set .

it gives :


How can i retrieve the other cookie ???


Do Right , Fear No Man
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you sure there's another cookie?
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
David Newton wrote:Are you sure there's another cookie?


yes first i am setting the cookie , then coming to this page
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

tushar panda wrote:yes first i am setting the cookie , then coming to this page

Are you saying that you are doing a forward to this page after setting the cookie(s) or something else ?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Vijitha Kumara wrote:Are you saying that you are doing a forward to this page after setting the cookie(s) or something else ?


no no , i am not doing forward , i mean to say that i have set another cookie apart from "JSESSIONID " but only "JESSIONID" appears and the other one doesnot .

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

tushar panda wrote:
Vijitha Kumara wrote:Are you saying that you are doing a forward to this page after setting the cookie(s) or something else ?

no no , i am not doing forward , i mean to say that i have set another cookie apart from "JSESSIONID " but only "JESSIONID" appears and the other one doesnot .

That means the browser is not sending the other cookie(s) besides the JSESSIONID cookie? Can you explain the request flow you used to test this?
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Vijitha Kumara wrote:That means the browser is not sending the other cookie(s) besides the JSESSIONID cookie?

yes

Vijitha Kumara wrote: Can you explain the request flow you used to test this?

unable to get , what do you mean by request flow .
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't understand why you haven't posted the code, config, and URLs you're using to test this.

The way you're displaying the cookies is correct--if there should be a cookie on that page, it'll display it. Which means in all probability there isn't the cookie there you think there is. Have you confirmed the cookie physically, either by using the browser tools, or checking on the disk? Is the path right? Show us the code.
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
thanks for reply

David Newton wrote:I don't understand why you haven't posted the code, config, and URLs you're using to test this.


code i have posted above at the top.
url i am using is correct
i cannot get about config ??? i mean to say what is the config you are talking about , please tell me ??

David Newton wrote:Which means in all probability there isn't the cookie there you think there is.

no its there i have checked it in mozilla - tools>options>privacy>showcookies .

David Newton wrote: Have you confirmed the cookie physically, either by using the browser tools, or checking on the disk?

checked in browser and it is present

David Newton wrote: Is the path right?

yes the path is right .
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's the code for *displaying* the cookies. That's not the only code being run, nor is it the only information necessary (or available) to help diagnose the problem.
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
sorry for a 2 day late reply

David Newton wrote:That's the code for *displaying* the cookies.

yeah i am talking about cookies , and it does not work .

David Newton wrote:That's not the only code being run

what else is required please reply ?
the code posted by me is directly taken from "Bruce perry's" book "java servlet and Jsp cookbook" ?
if its wrong then what else is required to display a cookie ?

David Newton wrote: nor is it the only information necessary (or available) to help diagnose the problem.

what else information do you want from me ?

anyway thanks for reply.

TUSHAR
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

When you're trying to diagnose a problem, you need everything related to the problem. In addition to displaying an existing cookie, the code that creates the cookie is required. You haven't provided the information about what's in the cookie, like the path information for both the working and non-working cookies. The URL of the page being requested that you're trying to display the cookies from.

We're not in front of your machine--you have to help us to help you.
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
I think that probably you don't have other cookies. Of course that there are a lot of cookies in your browser, but it must belong to your site. :]
If you are running in localhost, then the cookies must be in the localhost folder.
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
my browser has two cookies :


first cookie :


second cookie :



the servlet code below is setting and checking cookie :


i want to get the name and value of the "regcookie" and i get it in this servlet page at line 39 and 40 , but not in the jsp page.
in the jsp page i get only the name and value of "JSESSIONID" not the "regcookie".


how can i retrieve the value of regcookie .using scriptlet it is possible but i have no luck in EL .
please help.
 
wood burning stoves
 
subject: cookie problem