This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Sessions created randomly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sessions created randomly" Watch "Sessions created randomly" New topic
Author

Sessions created randomly

Vijaya Madduri
Greenhorn

Joined: Oct 25, 2005
Posts: 5
Hi,
I have a web application where I'm using Struts, Frameset, WebSphere 5.0 and IE 6. In my application, I could login and get the defined frameset successfully, but when I logoff and try to re-login in the same browser, sessions are getting created randomly even though I set create session false, and the session information is lost. I have seen a positing on web that session variables will be lost if frameset is used in IE 6. This may not be correct in my case, becos for the first time everything is working fine. I tries all possibilities.

Please share your ideas sothat I can try to fix the problem.

Thanks a lot
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

When you say you're setting create session to false, I assume you mean request.getSession(false), which doesn't do what I think you are expecting. Setting false there only means that if a session doesn't exist the method will return null instead of creating a new session. So for your situation the session is getting created by something else before reaching that method.

So two unexpected things are happening:
1) The original session is getting killed.
2) A new session is getting created on its own.

It's hard for me to know the cause of 1 without more info. Here are some insights for figuring out part 2:
Avoiding automatic creation of a session


A good workman is known by his tools.
Vijaya Madduri
Greenhorn

Joined: Oct 25, 2005
Posts: 5
Hi Marc,
Thank you very much for your reply. I tried setting the session attribute in page directive to false, but then I was totally unable to access the session information which is not the expected behaviour.

Strange thing is, everything is perfectly working for the first time, only one session is getting created and used through out, until I logoff. But when I logoff and re-login, the session ID is consistent till the frameset.jsp is accessed, and after that the session IDs are getting changed in the other 2 frame jsps. I could not suspect there is any problem with the code, becos the same code is working fine on WebSphere 3.5.3, and now when I'm trying on 5.0, I'm getting this problem.

Also I tried developing a test web application with the same Login-> Logoff->Login scenario, consisting of frameset. That is also working fine. So I thought the problem might not be with the frameset and browser version.

I appreciate if any new ideas are sent for debugging.

Thanks
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I haven't gotten a chance to say this in a while but here goes:

Frames are evil.

Now that I have that out of the way, without knowing anything about the frameset.jsp that you refer to, I'm assuming that a logout only occurs in a single frame and targets only itself and not the entire browser window. If it were to target the entire browser window it should start all three up with a new session the next time you enter the set of frames. Just a hunch.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sessions created randomly
 
Similar Threads
Creating sessions randomly
How to create n-second delay in .jsp ?
Tomcat 7 maintaining more than one session
HttpSession Object Persist Across Restart
Maintaining sessions