You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Smith Norton <sm...@gmail.com> on 2007/01/17 06:53:07 UTC

2 session variables JSESSIONID retrieved by JavaScript

This strange thing is happening in Internet Explorer 6

I use a simple JavaScript like this to read a cookie and set it back.
Ideally, it shouldn't alter the cookie value.

function setCookie()
{
	document.cookie=frmCookie.cookieString.value
	alert('Cookie: ' + frmCookie.cookieString.value + '; path=/' +
		'\n\nThis cookie is set.\nCookie display will now refresh.')
	frmCookie.cookieString.value=""
	frmCookie.cookieString.value=document.cookie
}

frmCookie.cookieString is a TEXTAREA being displayed in the webpage
itself, so that the user can see what cookie is being set.

The problem that occurs is that initially, the text area shows
something like this:-

JSESSIONID=EACC8AA771F13B4EECA464F0F535C399

After hitting the button that fires that script, the textarea shows:-

JSESSIONID=EACC8AA771F13B4EECA464F0F535C399;
JSESSIONID=EACC8AA771F13B4EECA464F0F535C399

The problem is rectified when I change the first line of the script to:-

function setCookie()
{
	document.cookie=frmCookie.cookieString.value + '; path=/'
        // Notice the extra 'path' information.

Can any one explain what's going wrong in the first case?

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org