----- Original Message ----- From: "Adam Lipscombe" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, October 12, 2007 10:09 AM
Subject: How to share tomcat sessions across multiple IE windows


Folks

I restarted this thread because I inadvertently hijacked another.


Peter Crowther said:

"You can't.  This is a client-side problem.  As your first link says:
Use a key in the querystring, tied to a cookie or a form, if session
state across windows is a necessity."



Can you expand on how this works please? If I pass the session ID from the calling window to the spawned window, what do I do with it? Look up the session cookie with JavaScript? Then what?
Ideally I want the child window to share the same session.

Sorry if I am being a bit thick here....

Hi there... There may be better ways of doing this, I just looked back and had a look at a progress meter I made a while ago...
Right or Wrong this is what I did....

I created a STATIC class that I called GlobalSessionStore...
This then can be uses across servlets JSP pages etc etc.

When the request comes in for the BASE page... I generate a unique number and place it in a hidden form field....
and add Session to GlobalSessionStore

When the user clicks on START script button it runs script something like this...
========================
function doProgress()
{
//The Hidden field
guid = document.getElementById("guid_id").value;
//Add it to the URL
sprogUrl = "/estate/listingEntry?cmd1=10001&UniqueID=" + guid;
window.open(sprogUrl,null,"toolbar=0, location=0,status=0, menubar=0, scrollbars=0, resizable=1, width=400, height=300");
}
==========================

So when that window opens... can now get guid with.....
request.getParameter("UniqueID");

Call the global static class.... can get at stored global Session.... done!

Anyway thats how I connected progress meters to the thing they have to monitor...

In your case if you (below) putItem(GUID, Session);
Should be able to get back anything in that original session....

Good Luck....

============================
public class globalSessionStore {

   private static HashMap sessionStore = new HashMap();

   /** Creates a new instance of globalSessionStore */
   public globalSessionStore() {
   }

    public static synchronized Object getItem(String sKey) {
 return (Object)sessionStore.get(sKey);
}

public static synchronized void putItem(String sKey, Object item) {
 sessionStore.put(sKey,item);
}

public static synchronized void removeItem(String sKey) {
 sessionStore.remove(sKey);
}

}

------------------------------------------------------
HARBOR : http://coolharbor.100free.com/index.htm
Tomcats very own application server
-------------------------------------------------------

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

Reply via email to