tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Smith Norton" <smith.nor...@gmail.com>
Subject 2 session variables JSESSIONID retrieved by JavaScript
Date Wed, 17 Jan 2007 05:53:07 GMT
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


Mime
View raw message