This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Session Handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Handling" Watch "Session Handling" New topic
Author

Session Handling

Madmax
Greenhorn

Joined: Nov 13, 2002
Posts: 6
Hi All,
We are using session cookies to maintain user information. We have a 'Logout' button, when clicked will call session.invalidate(); method to close the session.
The question is if the user clicks on the back button and clicks on the logout button again, the server throws the following jasper exception.
Error:
javax.servlet.jsp.JspException: No bean found under attribute key UserSessionObj
javax.servlet.jsp.JspException: No bean found under attribute key UserSessionObj
at org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.java:222)
at org.apache.struts.taglib.logic.EqualTag.condition(EqualTag.java:90)
at org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(ConditionalTagBase.java:218)
at org.apache.jsp.plainHeader_jsp._jspx_meth_logic_equal_0(plainHeader_jsp.java:127)
at org.apache.jsp.plainHeader_jsp._jspService(plainHeader_jsp.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
If anyone knows how to handle this, we would appreciate it.
Thanks,
Madmax.
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
hey, i would think about doing something like this in the code called after the logout button is pressed:
...
if(session!=null)
session.invalidate();
...


Asher Tarnopolski
SCJP,SCWCD
Madmax
Greenhorn

Joined: Nov 13, 2002
Posts: 6
Hi Asher Tarnopolski,
Thanks for the mail. Infact I have tried various options like putting the code in a if<statement> and try { } catch() block. It does not work.
What we are working on the web front is we are currently using struts framework. The web.xml has a listener class which has the session object. How do we make changes for it to recognise the session is invalid and redirect to login.jsp?
Thanks in advance.
Madmax
web.xml content:
<listener>
<listener-class>
com.infuz.agentEX.user.UserSessionObj
</listener-class>
</listener>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"madmax",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
hey, i see it's about struts i never worked with...
try struts forum!
does your session object implements HttpSessionActivationListener ? you can try to make sessionWillPassivate() method setting a cookie on user's machine. the logout button can check if this cookie is present. if it is- redirect to login page...once more, i don't have any idea about struts, so it's probably just a bla bla bla
[ November 26, 2002: Message edited by: Asher Tarno ]
Mark Stein
Ranch Hand

Joined: May 20, 2002
Posts: 75
I know you tried several versions of conditional statements.... have you tried putting your bean initialization tags in a conditional test for the session? It looks like your beans are trying to initialize but the info is gone.
MS
 
jQuery in Action, 2nd edition
 
subject: Session Handling
 
Similar Threads
Update database for logout when signout is not done properly
problems in logout
No bean found under attribute key
how to terminate session when closing the browser?
Session handling in structs framework