Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Handling

 
Madmax
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey, i would think about doing something like this in the code called after the logout button is pressed:
...
if(session!=null)
session.invalidate();
...
 
Madmax
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic