java - How to separate sessions for new browser instance of IE8 using servlet? -


i facing problem of creating new session , maintaining previous 1 @ same time.

my code in servlet. works other browsers ie , ie7 , lower versions, not ie8 , ie9. knew ie8 & ie9 uses same session every new request; want create new session every new initial request java ee application. wrote code creation of new httpsession first time when session null , added code new session.

what can code changes new session, without maintaining hidden variable value on every page or sending session id through url? there other way possible separate 2 or more sessions?

my servlet code snapshot 1 below:

protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {     process(request, response); }  private void process (httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {      string strerrormsg = null;     response.setcontenttype ( "text/html" );     httpsession session = null;     cookie cookies[] = request.getcookies();      if (session == null) {         servletcontext appcontext = getservletcontext();         webprocesscontextbuilder builder =  webprocesscontextbuilder.getinstance();         processcontext objcontext = null;         try {             session = request.getsession(true);             // code setting initial session attributes , forwarding request              // first window display.         }     }      if (session != null && session.isnew()) {         // code new session forward request saving session id          // setting session attributes     } else {         // code showing alert message "session active in window or tab.";     } } 

using above code, on 2nd time when tried load new application i'm getting error message. it's because getting session not equal null , session.isnew false in case of ie8 & ie9. elsewhere works properly.

this doesn't right:

httpsession session = null; cookie cookies[] = request.getcookies();  if (session == null) { 

how session not null here?

i think should be:

// try session, don't create 1 if there isn't 1 httpsession session = request.getsession(false); cookie cookies[] = request.getcookies();  if (session == null) { 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -