I'm not sure why your P cookie isn't showing up, but the JSESSIONID cookie
is a session cookie so it is only maintained in RAM and never gets written
to disk. If you don't set the max age, the cookie only lives for the
current session.
To figure out why the P cookie isn't working, turn on cookie warnings on
your browser and make sure your browser actually got the cookie. Mozilla
(and NS 6.x) has a menu option for viewing cookies that are in RAM or on
disk.
Jay
On Mon, 29 Apr 2002, John Regan wrote:
> I am John Regan.
>
> Environment:
> NT
> IE 5.0
> Tomcat 4.0
> Struts 1.0
>
> When a user requests our index page we write a pagehit sequence # to the
> client's cookie through the following code:
> //no cookie exits
> else {
> Cookie pcookie = new Cookie("P",r.getPagehitcode());
> pcookie.setMaxAge(60*60*24*365);//1 year
> response.addCookie(pcookie);
> }
> which works fine, I look in my cookies directory and find a file named
> jbr@jsp[1].txt(where does it grab this name from?) which contains the
> correct value for "P".
> The user clicks on a link on the homepage, this where things start to go
> very wrong. In the action class I loop through cookie values in the
> following manner:
>
> Cookie[] cookies = request.getCookies();
> Cookie cookie;
> Cookie schangecookie = null;
> if (cookies != null) {
> for(int i=0; i<cookies.length; i++) {
> cookie = cookies[i];
> servlet.log("cookie" + cookie.getName() + " " +
> cookie.getValue());
> if (cookie.getName().equals("P")) {
> schangecookie = (Cookie)cookie.clone();
> schangecookie.setValue(r.getPagehitcode());
> response.addCookie(schangecookie);
> }
> }
>
> The log shows the only cookie in the request is the following:
>
> JSESSIONID A37259C0F90335C6B3B177A1C2679413
>
> The "P" value which I see in my cookie is not in the request! Not to
> mention, I don't where JSESSIONID is stored!
>
> Can someone clue me in to what might be happening?
>
> Any help is much appreciated!
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>