Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

session variable data lost or weirdness  RSS feed

 
wayne forrest
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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....


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!