You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rey Francois <Fr...@capco.com> on 2001/09/05 16:17:15 UTC

RE: Session STOMP

I have actually the same problem on Tomcat 3.3 Beta 1, my session is renewed
for each request... What container do you use ?

Fr.

-----Original Message-----
From: Clay Graham [mailto:cyber23@best.com]
Sent: 05 September 2001 17:26
To: 'struts-user@jakarta.apache.org'
Subject: Session STOMP


User Crew,

My sessions are being stomped (or actually being overriden by new ones) 
every time I make a new request. They are fine from the form to the action 
part, but the second I do a new request the session evaporates. I need to 
be able to keep the session around because I have a userMgr object that I 
store in the session that I need as long as the user is logged in (old 
hat).

                            the_session.setAttribute("UserMgr", 
l_new_user);
                            the_session.setMaxInactiveInterval(300);

so when it gets to the home page for logged in users it gets the user 
manager fine:

Welcome to Contextuon Clay!
session id:8k2hwyjun1
session attributes:
org.apache.struts.action.TOKEN
org.apache.struts.action.LOCALE
UserMgr
loginForm
and the URL that made that fine message relates to the action handler for 
login
http://localhost/contextuon/login.do;jsessionid=8k2hwyjun1
great....goodness...I saved the user manager to session, now the problem 
starts....the user is logged in so they can goto all "user pages", those 
pages will actually forward back to the login page if the user is not 
logged in.
<jsp:useBean id="UserMgr" scope="session" 
class="com.noi.webapp.contextuon.bl.UserMgr" />
<% if (UserMgr.isActive() == false){%>
	<jsp:forward page='logon.jsp' />
<%}%>
THE PROBLEM: from this point forward any request will stomp the session and 
create a new one. The UserMgr is gone on any "user page" because there is 
an entirely new session. I use a goto action to make sure I am not leaving 
the struts framework and pass a forward directive to the action 
handler...(paranoia)
http://localhost/contextuon/goto.do?forward=contextmgr
I tried using the "false" directive in this action
HttpSession session = request.getSession(false);
but that didn't do a thing.
any ideas why my session.....EVAPORATES?
any ideas are appreciated.

Clay





ok, so just to make it clear...I NEVER do this (Except in my logout action 
which has not happened), so it ain't me.

	session.removeAttribute("UsrMgr");
	session.invalidate();



So I don't know why this is happening, or even if its because of struts, it 
may actually be Tomcat that is generating new sessions but I found out 
about it while writing my my LoginAction class so there ya have it...


************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.

http://www.capco.com
***********************************************************************