• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

session variable data lost or weirdness

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having some problems with my session variables being lost, currently I think this is only for IE9.
The code seems to work for FireFox/Chrome/Safari/IE8 but not for IE9.


I have noticed that the SESSION IDS' returned are different when I use IE9, whereas with other browsers the ID's are the same.
I think the problem could be in the way that the "Capcha" servlet is called, via a "GET". Whereas the rest of the validation is done via a "POST".


What's wrong with this approach or is there perhaps something I should be doing different ?


Here is the JSP Page snippet: For IE9 the ID produced on Line 2 differs from Line 74 in the second snippet of code.



And the servlet code I got via google slightly modified:


 
wayne forrest
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am still banging my head at this :

The following seems to persist getServletContext().getAttribute for IE and others.

Still not sure why the session variables are lost.

 
wayne forrest
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have looked at the data:

Comparing Chrome against IE9 using an application called "Fidler".

By looking at the data I noticed that the server/tomcat sends a new cookie JSESSIONID for each URL
in this case one for the JSP page and one for the "Capthca" servlet page.

By inspecting further, almost missed this; I noticed that IE9 did not send the cookie to the server for the second call (Capthca servlet),
and that is why the server(tomcat) issues a new JSESSIONID cookie.

by calls I mean
1) Serve JSP page
2) Serve Captcha page

Still not sure how to fix this though

I am starting to think that this is more of an IE9 and Tomcat issue

System.out.println("JSP ID:"+session.getId());

Gives a new ID for each page refresh in IE9, WHY ???
 
wayne forrest
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally,

starting to make *SOME* sense with IE9,

what I did not mention was that I have a static html page that is served from TOMCAT, index.html,
and this page has a link to the JSP page.

the link was set to use my LAN IP, 192.168.0.X

And when I test the JSP PAGE I always went to

http://localhost:8080/MyApplication/index.html

and clicked the link (http://192.168.0.x:8080/MyApplication/login.jsp)


Changing localhost to the actual IP: 192.168.0.x made this WORK !!! I find this strange....


 
Tell me how it all turns out. Here is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic